summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/mir-opt
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/mir-opt/README.md18
-rw-r--r--tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir60
-rw-r--r--tests/mir-opt/address_of.rs1
-rw-r--r--tests/mir-opt/array_index_is_temporary.rs7
-rw-r--r--tests/mir-opt/asm_unwind_panic_abort.rs3
-rw-r--r--tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir4
-rw-r--r--tests/mir-opt/basic_assignment.rs18
-rw-r--r--tests/mir-opt/bool_compare.opt1.InstSimplify.diff36
-rw-r--r--tests/mir-opt/bool_compare.opt2.InstSimplify.diff36
-rw-r--r--tests/mir-opt/bool_compare.opt3.InstSimplify.diff36
-rw-r--r--tests/mir-opt/bool_compare.opt4.InstSimplify.diff36
-rw-r--r--tests/mir-opt/bool_compare.rs28
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir71
-rw-r--r--tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir71
-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.mir47
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir347
-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.rs1
-rw-r--r--tests/mir-opt/building/custom/arbitrary_let.rs1
-rw-r--r--tests/mir-opt/building/custom/arrays.rs1
-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/consts.rs1
-rw-r--r--tests/mir-opt/building/custom/consts.statics.built.after.mir8
-rw-r--r--tests/mir-opt/building/custom/debuginfo.rs1
-rw-r--r--tests/mir-opt/building/custom/enums.rs1
-rw-r--r--tests/mir-opt/building/custom/operators.rs1
-rw-r--r--tests/mir-opt/building/custom/projections.rs1
-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/terminators.rs1
-rw-r--r--tests/mir-opt/building/enum_cast.rs1
-rw-r--r--tests/mir-opt/building/issue_101867.main.built.after.mir6
-rw-r--r--tests/mir-opt/building/issue_101867.rs1
-rw-r--r--tests/mir-opt/building/issue_110508.rs1
-rw-r--r--tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir4
-rw-r--r--tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir4
-rw-r--r--tests/mir-opt/building/issue_49232.main.built.after.mir2
-rw-r--r--tests/mir-opt/building/issue_49232.rs1
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.rs1
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir4
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir3
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir3
-rw-r--r--tests/mir-opt/building/match_false_edges.main.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.rs1
-rw-r--r--tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir8
-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/simple_match.match_bool.built.after.mir2
-rw-r--r--tests/mir-opt/building/simple_match.rs1
-rw-r--r--tests/mir-opt/building/storage_live_dead_in_statics.rs1
-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.mir2
-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_clone_of_primitives.rs20
-rw-r--r--tests/mir-opt/combine_transmutes.rs43
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir36
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir40
-rw-r--r--tests/mir-opt/const_allocation.rs1
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir34
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir36
-rw-r--r--tests/mir-opt/const_allocation2.rs1
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir20
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir18
-rw-r--r--tests/mir-opt/const_allocation3.rs1
-rw-r--r--tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff79
-rw-r--r--tests/mir-opt/const_debuginfo.rs16
-rw-r--r--tests/mir-opt/const_goto.rs1
-rw-r--r--tests/mir-opt/const_goto_const_eval_fail.rs1
-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.mir4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff4
-rw-r--r--tests/mir-opt/const_promotion_extern_static.rs1
-rw-r--r--tests/mir-opt/const_prop/address_of_pair.rs1
-rw-r--r--tests/mir-opt/const_prop/aggregate.rs1
-rw-r--r--tests/mir-opt/const_prop/array_index.rs1
-rw-r--r--tests/mir-opt/const_prop/bad_op_div_by_zero.rs1
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.rs1
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs1
-rw-r--r--tests/mir-opt/const_prop/boolean_identities.rs1
-rw-r--r--tests/mir-opt/const_prop/boxes.rs1
-rw-r--r--tests/mir-opt/const_prop/cast.rs1
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/checked_add.rs1
-rw-r--r--tests/mir-opt/const_prop/const_prop_fails_gracefully.rs1
-rw-r--r--tests/mir-opt/const_prop/control_flow_simplification.rs1
-rw-r--r--tests/mir-opt/const_prop/discriminant.rs1
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/indirect.rs1
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff (renamed from tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff (renamed from tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/indirect_mutation.rs41
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/inherit_overflow.rs1
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.rs1
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff4
-rw-r--r--tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff4
-rw-r--r--tests/mir-opt/const_prop/issue_66971.rs1
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/issue_67019.rs1
-rw-r--r--tests/mir-opt/const_prop/large_array_index.rs1
-rw-r--r--tests/mir-opt/const_prop/mult_by_zero.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff4
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff4
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.rs1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs1
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff56
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff56
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-abort.diff50
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff50
-rw-r--r--tests/mir-opt/const_prop/offset_of.rs20
-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/read_immutable_static.main.ConstProp.diff6
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.rs1
-rw-r--r--tests/mir-opt/const_prop/ref_deref.rs1
-rw-r--r--tests/mir-opt/const_prop/ref_deref_project.rs1
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.rs1
-rw-r--r--tests/mir-opt/const_prop/repeat.rs1
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff2
-rw-r--r--tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff2
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir2
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir2
-rw-r--r--tests/mir-opt/const_prop/return_place.rs1
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.rs1
-rw-r--r--tests/mir-opt/const_prop/slice_len.rs1
-rw-r--r--tests/mir-opt/const_prop/switch_int.rs1
-rw-r--r--tests/mir-opt/const_prop/transmute.rs22
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff3
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff3
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff6
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff6
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.rs1
-rw-r--r--tests/mir-opt/const_prop/while_let_loops.rs1
-rw-r--r--tests/mir-opt/const_prop_miscompile.rs23
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.rs1
-rw-r--r--tests/mir-opt/copy-prop/branch.rs1
-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.rs1
-rw-r--r--tests/mir-opt/copy-prop/custom_move_arg.rs1
-rw-r--r--tests/mir-opt/copy-prop/cycle.rs1
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_79191.rs1
-rw-r--r--tests/mir-opt/copy-prop/dead_stores_better.rs1
-rw-r--r--tests/mir-opt/copy-prop/issue_107511.rs1
-rw-r--r--tests/mir-opt/copy-prop/move_arg.rs1
-rw-r--r--tests/mir-opt/copy-prop/move_projection.rs1
-rw-r--r--tests/mir-opt/copy-prop/mutate_through_pointer.rs1
-rw-r--r--tests/mir-opt/copy-prop/non_dominate.rs1
-rw-r--r--tests/mir-opt/copy-prop/partial_init.rs1
-rw-r--r--tests/mir-opt/copy-prop/reborrow.rs1
-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.rs30
-rw-r--r--tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir86
-rw-r--r--tests/mir-opt/coroutine_tiny.rs27
-rw-r--r--tests/mir-opt/dataflow-const-prop/array_index.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/boolean_identities.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/cast.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff12
-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.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.32bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.ConstProp.64bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff12
-rw-r--r--tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff7
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff7
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff19
-rw-r--r--tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff19
-rw-r--r--tests/mir-opt/dataflow-const-prop/if.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/inherit_overflow.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/issue_81605.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/large_array_index.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/mult_by_zero.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.concrete.DataflowConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-abort.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.generic.DataflowConstProp.panic-unwind.diff8
-rw-r--r--tests/mir-opt/dataflow-const-prop/offset_of.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/ref_without_sb.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/repeat.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff13
-rw-r--r--tests/mir-opt/dataflow-const-prop/repr_transparent.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/self_assign_add.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/sibling_ptr.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/slice_len.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff228
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff228
-rw-r--r--tests/mir-opt/dataflow-const-prop/struct.rs26
-rw-r--r--tests/mir-opt/dataflow-const-prop/terminator.rs1
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.rs22
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.32bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.undef_union_as_integer.DataflowConstProp.64bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff2
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.32bit.diff6
-rw-r--r--tests/mir-opt/dataflow-const-prop/transmute.unreachable_direct.DataflowConstProp.64bit.diff6
-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.rs1
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff29
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff73
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff73
-rw-r--r--tests/mir-opt/dead-store-elimination/cycle.rs38
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.rs1
-rw-r--r--tests/mir-opt/dead-store-elimination/provenance_soundness.rs1
-rw-r--r--tests/mir-opt/deduplicate_blocks.rs1
-rw-r--r--tests/mir-opt/deref-patterns/string.rs1
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff2
-rw-r--r--tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff2
-rw-r--r--tests/mir-opt/derefer_complex_case.rs1
-rw-r--r--tests/mir-opt/derefer_inline_test.rs1
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff10
-rw-r--r--tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff10
-rw-r--r--tests/mir-opt/derefer_terminator_test.rs1
-rw-r--r--tests/mir-opt/derefer_test.rs1
-rw-r--r--tests/mir-opt/derefer_test_multiple.rs1
-rw-r--r--tests/mir-opt/dest-prop/branch.rs1
-rw-r--r--tests/mir-opt/dest-prop/copy_propagation_arg.rs1
-rw-r--r--tests/mir-opt/dest-prop/cycle.rs1
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_79191.rs1
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir7
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir7
-rw-r--r--tests/mir-opt/dest-prop/dead_stores_better.rs1
-rw-r--r--tests/mir-opt/dest-prop/simple.rs1
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff17
-rw-r--r--tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff17
-rw-r--r--tests/mir-opt/dest-prop/union.rs1
-rw-r--r--tests/mir-opt/dest-prop/unreachable.rs1
-rw-r--r--tests/mir-opt/dont_inline_type_id.rs1
-rw-r--r--tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff19
-rw-r--r--tests/mir-opt/dont_yeet_assert.rs11
-rw-r--r--tests/mir-opt/early_otherwise_branch.rs1
-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_noopt.rs1
-rw-r--r--tests/mir-opt/early_otherwise_branch_soundness.rs1
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff2
-rw-r--r--tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff2
-rw-r--r--tests/mir-opt/enum_opt.rs1
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff2
-rw-r--r--tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff2
-rw-r--r--tests/mir-opt/equal_true.opt.InstSimplify.diff36
-rw-r--r--tests/mir-opt/equal_true.rs11
-rw-r--r--tests/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir2
-rw-r--r--tests/mir-opt/exponential_or.rs1
-rw-r--r--tests/mir-opt/fn_ptr_shim.rs1
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff124
-rw-r--r--tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff124
-rw-r--r--tests/mir-opt/funky_arms.rs1
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir82
-rw-r--r--tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.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.panic-abort.mir83
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir118
-rw-r--r--tests/mir-opt/generator_storage_dead_unwind.rs29
-rw-r--r--tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir86
-rw-r--r--tests/mir-opt/generator_tiny.rs26
-rw-r--r--tests/mir-opt/graphviz.rs1
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff121
-rw-r--r--tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff121
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff308
-rw-r--r--tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff308
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff66
-rw-r--r--tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff66
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-abort.diff291
-rw-r--r--tests/mir-opt/gvn.cast.GVN.panic-unwind.diff291
-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.dereferences.GVN.panic-abort.diff32
-rw-r--r--tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff32
-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.diff136
-rw-r--r--tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff136
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-abort.diff79
-rw-r--r--tests/mir-opt/gvn.references.GVN.panic-unwind.diff101
-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.diff19
-rw-r--r--tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff19
-rw-r--r--tests/mir-opt/gvn.rs488
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-abort.diff136
-rw-r--r--tests/mir-opt/gvn.slices.GVN.panic-unwind.diff136
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff1091
-rw-r--r--tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff1091
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff22
-rw-r--r--tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff22
-rw-r--r--tests/mir-opt/if_condition_int.rs1
-rw-r--r--tests/mir-opt/inline/asm_unwind.rs5
-rw-r--r--tests/mir-opt/inline/caller_with_trivial_bound.rs5
-rw-r--r--tests/mir-opt/inline/cycle.rs10
-rw-r--r--tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs2
-rw-r--r--tests/mir-opt/inline/dyn_trait.rs8
-rw-r--r--tests/mir-opt/inline/exponential_runtime.rs9
-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.rs2
-rw-r--r--tests/mir-opt/inline/inline_closure.rs3
-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.mir4
-rw-r--r--tests/mir-opt/inline/inline_closure_captures.rs3
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff21
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff22
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff22
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff19
-rw-r--r--tests/mir-opt/inline/inline_compatibility.rs63
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff112
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff124
-rw-r--r--tests/mir-opt/inline/inline_coroutine.rs20
-rw-r--r--tests/mir-opt/inline/inline_cycle.rs1
-rw-r--r--tests/mir-opt/inline/inline_cycle_generic.rs1
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff4
-rw-r--r--tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/inline_diverging.rs7
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff108
-rw-r--r--tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff120
-rw-r--r--tests/mir-opt/inline/inline_generator.rs17
-rw-r--r--tests/mir-opt/inline/inline_instruction_set.rs10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff10
-rw-r--r--tests/mir-opt/inline/inline_into_box_place.rs2
-rw-r--r--tests/mir-opt/inline/inline_options.rs3
-rw-r--r--tests/mir-opt/inline/inline_retag.rs11
-rw-r--r--tests/mir-opt/inline/inline_shims.rs4
-rw-r--r--tests/mir-opt/inline/inline_specialization.rs2
-rw-r--r--tests/mir-opt/inline/inline_trait_method.rs3
-rw-r--r--tests/mir-opt/inline/inline_trait_method_2.rs3
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline/issue_106141.rs7
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir4
-rw-r--r--tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir4
-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.mir6
-rw-r--r--tests/mir-opt/inline/issue_76997_inline_scopes_parenting.rs10
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff22
-rw-r--r--tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff31
-rw-r--r--tests/mir-opt/inline/issue_78442.rs5
-rw-r--r--tests/mir-opt/inline/polymorphic_recursion.rs1
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.rs10
-rw-r--r--tests/mir-opt/inline/unit_test.rs19
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff24
-rw-r--r--tests/mir-opt/inline/unsized_argument.rs2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.rs2
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff18
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff30
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir19
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir19
-rw-r--r--tests/mir-opt/inline_generically_if_sized.rs1
-rw-r--r--tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff4
-rw-r--r--tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff17
-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.diff (renamed from tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff (renamed from tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_array_len.rs (renamed from tests/mir-opt/combine_array_len.rs)4
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.rs24
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff (renamed from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff)6
-rw-r--r--tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff (renamed from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff)6
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.rs65
-rw-r--r--tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff (renamed from tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff)0
-rw-r--r--tests/mir-opt/instsimplify/duplicate_switch_targets.rs29
-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.diff (renamed from tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff)14
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff)14
-rw-r--r--tests/mir-opt/instsimplify/intrinsic_asserts.rs50
-rw-r--r--tests/mir-opt/instsimplify_duplicate_switch_targets.rs27
-rw-r--r--tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff33
-rw-r--r--tests/mir-opt/intrinsic_asserts.rs28
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff1
-rw-r--r--tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff1
-rw-r--r--tests/mir-opt/issue_101973.rs1
-rw-r--r--tests/mir-opt/issue_104451_unwindable_intrinsics.rs1
-rw-r--r--tests/mir-opt/issue_38669.rs1
-rw-r--r--tests/mir-opt/issue_41110.rs1
-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.mir4
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff41
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff41
-rw-r--r--tests/mir-opt/issue_41888.rs1
-rw-r--r--tests/mir-opt/issue_62289.rs1
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir1
-rw-r--r--tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir1
-rw-r--r--tests/mir-opt/issue_72181.rs1
-rw-r--r--tests/mir-opt/issue_72181_1.f.built.after.mir1
-rw-r--r--tests/mir-opt/issue_72181_1.main.built.after.mir4
-rw-r--r--tests/mir-opt/issue_72181_1.rs1
-rw-r--r--tests/mir-opt/issue_76432.rs1
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff47
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff47
-rw-r--r--tests/mir-opt/issue_78192.rs1
-rw-r--r--tests/mir-opt/issue_91633.rs1
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.32bit.mir10
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.64bit.mir10
-rw-r--r--tests/mir-opt/issue_99325.rs1
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir42
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir42
-rw-r--r--tests/mir-opt/issues/issue_59352.rs1
-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.rs1
-rw-r--r--tests/mir-opt/lower_array_len.rs14
-rw-r--r--tests/mir-opt/lower_intrinsics.rs87
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff3
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff3
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff1
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff1
-rw-r--r--tests/mir-opt/lower_slice_len.rs4
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff2
-rw-r--r--tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff2
-rw-r--r--tests/mir-opt/match_arm_scopes.rs1
-rw-r--r--tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir2
-rw-r--r--tests/mir-opt/match_test.rs1
-rw-r--r--tests/mir-opt/matches_reduce_branches.rs1
-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/nll/named_lifetimes_basic.rs1
-rw-r--r--tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir16
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir4
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir4
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.rs1
-rw-r--r--tests/mir-opt/no_drop_for_inactive_variant.rs1
-rw-r--r--tests/mir-opt/no_spurious_drop_after_call.rs1
-rw-r--r--tests/mir-opt/not_equal_false.opt.InstSimplify.diff36
-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_simple.rs1
-rw-r--r--tests/mir-opt/packed_struct_drop_aligned.rs1
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir43
-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.mir11
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs1
-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.mir23
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir99
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir46
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs1
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.rs1
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir115
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir115
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir64
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir64
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir6
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir252
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir131
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir131
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir25
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir25
-rw-r--r--tests/mir-opt/pre-codegen/spans.rs1
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs1
-rw-r--r--tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff22
-rw-r--r--tests/mir-opt/reference_prop.rs333
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff3
-rw-r--r--tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff3
-rw-r--r--tests/mir-opt/remove_fake_borrows.rs1
-rw-r--r--tests/mir-opt/remove_never_const.rs1
-rw-r--r--tests/mir-opt/remove_storage_markers.rs1
-rw-r--r--tests/mir-opt/remove_unneeded_drops.rs1
-rw-r--r--tests/mir-opt/remove_zsts.rs1
-rw-r--r--tests/mir-opt/retag.rs1
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo.SimplifyCfg-elaborate-drops.after.panic-unwind.mir4
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-abort.mir4
-rw-r--r--tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-elaborate-drops.after.panic-unwind.mir4
-rw-r--r--tests/mir-opt/return_an_array.rs1
-rw-r--r--tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff8
-rw-r--r--tests/mir-opt/separate_const_switch.rs1
-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.rs1
-rw-r--r--tests/mir-opt/simplify_duplicate_unreachable_blocks.rs1
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff8
-rw-r--r--tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff8
-rw-r--r--tests/mir-opt/simplify_if.rs1
-rw-r--r--tests/mir-opt/simplify_locals.rs1
-rw-r--r--tests/mir-opt/simplify_locals_fixedpoint.rs1
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_consts.rs1
-rw-r--r--tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.rs1
-rw-r--r--tests/mir-opt/simplify_match.rs1
-rw-r--r--tests/mir-opt/simplify_try_if_let.rs1
-rw-r--r--tests/mir-opt/slice_drop_shim.rs1
-rw-r--r--tests/mir-opt/spanview_block.main.built.after.html6
-rw-r--r--tests/mir-opt/spanview_block.rs1
-rw-r--r--tests/mir-opt/spanview_statement.main.built.after.html6
-rw-r--r--tests/mir-opt/spanview_statement.rs1
-rw-r--r--tests/mir-opt/spanview_terminator.main.built.after.html4
-rw-r--r--tests/mir-opt/spanview_terminator.rs1
-rw-r--r--tests/mir-opt/sroa/lifetimes.rs1
-rw-r--r--tests/mir-opt/sroa/structs.rs1
-rw-r--r--tests/mir-opt/ssa_unreachable_116212.rs1
-rw-r--r--tests/mir-opt/storage_ranges.main.nll.0.mir2
-rw-r--r--tests/mir-opt/storage_ranges.rs1
-rw-r--r--tests/mir-opt/switch_to_self.rs1
-rw-r--r--tests/mir-opt/tls_access.rs1
-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.mir60
-rw-r--r--tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff80
-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.mir85
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff115
-rw-r--r--tests/mir-opt/uninhabited_enum_branching2.rs34
-rw-r--r--tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff6
-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.panic-abort.diff67
-rw-r--r--tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff67
-rw-r--r--tests/mir-opt/unreachable.rs49
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff6
-rw-r--r--tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff6
-rw-r--r--tests/mir-opt/unreachable_diverging.rs19
-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.mir4
-rw-r--r--tests/mir-opt/while_storage.rs20
-rw-r--r--tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir46
-rw-r--r--tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir46
631 files changed, 12064 insertions, 6872 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 61aa89e44..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,36 +1,36 @@
// 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: ();
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.rs b/tests/mir-opt/array_index_is_temporary.rs
index 950429fb6..f5edc6890 100644
--- a/tests/mir-opt/array_index_is_temporary.rs
+++ b/tests/mir-opt/array_index_is_temporary.rs
@@ -1,3 +1,4 @@
+// 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.
@@ -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.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.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir
index 75070ffda..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,8 +1,8 @@
// 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: ();
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 657c11516..000000000
--- a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt1` before InstSimplify
-+ // MIR for `opt1` after InstSimplify
-
- fn opt1(_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/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
deleted file mode 100644
index bc8be62bd..000000000
--- a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt2` before InstSimplify
-+ // MIR for `opt2` after InstSimplify
-
- fn opt2(_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/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
deleted file mode 100644
index 034d5e440..000000000
--- a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt3` before InstSimplify
-+ // MIR for `opt3` after InstSimplify
-
- fn opt3(_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/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
deleted file mode 100644
index d3096da6c..000000000
--- a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt4` before InstSimplify
-+ // MIR for `opt4` after InstSimplify
-
- fn opt4(_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/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.panic-abort.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
deleted file mode 100644
index 1c7ef7f83..000000000
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-abort.mir
+++ /dev/null
@@ -1,71 +0,0 @@
-// MIR for `main` before 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>;
- 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: bb9];
- }
-
- bb1: {
- StorageLive(_5);
- _5 = ShallowInitBox(move _4, S);
- (*_5) = S::new() -> [return: bb2, unwind: bb8];
- }
-
- bb2: {
- _1 = move _5;
- drop(_5) -> [return: bb3, unwind: bb9];
- }
-
- 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: bb9];
- }
-
- bb5: {
- StorageDead(_1);
- return;
- }
-
- bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate(cleanup)];
- }
-
- bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb9 (cleanup): {
- resume;
- }
-}
diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
deleted file mode 100644
index 4ad1c2de1..000000000
--- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir
+++ /dev/null
@@ -1,71 +0,0 @@
-// MIR for `main` before 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>;
- 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];
- }
-
- 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];
- }
-
- bb5: {
- StorageDead(_1);
- return;
- }
-
- bb6 (cleanup): {
- drop(_7) -> [return: bb7, unwind terminate(cleanup)];
- }
-
- bb7 (cleanup): {
- drop(_1) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb8 (cleanup): {
- drop(_5) -> [return: bb9, unwind terminate(cleanup)];
- }
-
- bb9 (cleanup): {
- resume;
- }
-}
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 780420bda..0421e232a 100644
--- a/tests/mir-opt/box_expr.rs
+++ b/tests/mir-opt/box_expr.rs
@@ -1,9 +1,22 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// 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 98b1befc3..000000000
--- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir
+++ /dev/null
@@ -1,47 +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;
- 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:11:14: 11: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:11:14: 11:16}))) = 1;
- return;
- }
-
- bb3: {
- goto -> bb2;
- }
-
- bb4: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable];
- }
-
- bb5: {
- unreachable;
- }
-}
diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
new file mode 100644
index 000000000..396e4a378
--- /dev/null
+++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir
@@ -0,0 +1,347 @@
+// 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:9: 16:14 (#8),
+ 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:9: 17: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: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;
+ 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;
+ 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 15330b13c..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: Generator(
- DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
- [
- std::future::ResumeTy,
- (),
- (),
- GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
- (),
- ],
- Static,
- ),
- source_info: SourceInfo {
- span: $DIR/async_await.rs:15:9: 15:14 (#8),
- scope: scope[0],
- },
- ignore_for_traits: false,
- },
- _1: GeneratorSavedTy {
- ty: Generator(
- DefId(0:4 ~ async_await[ccf8]::a::{closure#0}),
- [
- std::future::ResumeTy,
- (),
- (),
- GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []),
- (),
- ],
- Static,
- ),
- source_info: SourceInfo {
- span: $DIR/async_await.rs:16:9: 16:14 (#10),
- scope: scope[0],
- },
- 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;
- let mut _0: std::task::Poll<()>;
- let _3: ();
- let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _7: ();
- let _8: ();
- let mut _9: std::task::Poll<()>;
- let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
- let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _13: &mut std::task::Context<'_>;
- let mut _14: &mut std::task::Context<'_>;
- let mut _15: &mut std::task::Context<'_>;
- 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:11:14: 11:16};
- let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let _24: ();
- let mut _25: std::task::Poll<()>;
- let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>;
- let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16};
- let mut _29: &mut std::task::Context<'_>;
- let mut _30: &mut std::task::Context<'_>;
- let mut _31: &mut std::task::Context<'_>;
- 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:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
- let _17: ();
- scope 2 {
- }
- scope 3 {
- debug result => _17;
- }
- }
- scope 4 {
- debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
- let _33: ();
- scope 5 {
- }
- scope 6 {
- debug result => _33;
- }
- }
-
- bb0: {
- _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})));
- switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30];
- }
-
- bb1: {
- _38 = move _2;
- StorageLive(_3);
- StorageLive(_4);
- StorageLive(_5);
- _5 = a() -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
- _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
- }
-
- bb3: {
- StorageDead(_5);
- nop;
- (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11: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:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
- _11 = &mut (*_12);
- _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11: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:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
- }
-
- bb7: {
- StorageDead(_13);
- StorageDead(_10);
- _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;
- discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17: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:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11: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:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
- }
-
- bb15: {
- StorageDead(_22);
- nop;
- (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11: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:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16});
- _27 = &mut (*_28);
- _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11: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:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
- }
-
- bb19: {
- StorageDead(_29);
- StorageDead(_26);
- _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;
- discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17: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:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11: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:14:18: 17: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.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.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/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.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.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/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 ea394c5b7..a5cb6ff99 100644
--- a/tests/mir-opt/building/custom/consts.statics.built.after.mir
+++ b/tests/mir-opt/building/custom/consts.statics.built.after.mir
@@ -6,16 +6,16 @@ fn statics() -> () {
let mut _2: *mut i32;
bb0: {
- _1 = const {alloc1: &i32};
- _2 = const {alloc2: *mut i32};
+ _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.rs b/tests/mir-opt/building/custom/debuginfo.rs
index bfdc3d3ea..3671a1ef0 100644
--- a/tests/mir-opt/building/custom/debuginfo.rs
+++ b/tests/mir-opt/building/custom/debuginfo.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(custom_mir, core_intrinsics)]
extern crate core;
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/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.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/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/terminators.rs b/tests/mir-opt/building/custom/terminators.rs
index 123118f65..9e442e0f9 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;
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/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir
index 915c5ef11..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,8 +1,8 @@
// 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: ();
@@ -25,7 +25,7 @@ fn main() -> () {
FakeRead(ForLet(None), _1);
AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] });
StorageLive(_5);
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
_6 = discriminant(_1);
switchInt(move _6) -> [1: bb4, otherwise: bb3];
}
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
index bcbb1c298..e597cd5d0 100644
--- a/tests/mir-opt/building/issue_110508.rs
+++ b/tests/mir-opt/building/issue_110508.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir
// EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir
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
index 5fc6d911a..c3d28fae5 100644
--- 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
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/issue_110508.rs:8:1: 8:9>::BAR` after built
+// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR` after built
-const <impl at $DIR/issue_110508.rs:8:1: 8:9>::BAR: Foo = {
+const <impl at $DIR/issue_110508.rs:9:1: 9:9>::BAR: Foo = {
let mut _0: Foo;
let mut _1: ();
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
index 1a8925599..177518c30 100644
--- 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
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/issue_110508.rs:8:1: 8:9>::SELF_BAR` after built
+// MIR for `<impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR` after built
-const <impl at $DIR/issue_110508.rs:8:1: 8:9>::SELF_BAR: Foo = {
+const <impl at $DIR/issue_110508.rs:9:1: 9:9>::SELF_BAR: Foo = {
let mut _0: Foo;
let mut _1: ();
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 f809132bc..ac50b3889 100644
--- a/tests/mir-opt/building/issue_49232.main.built.after.mir
+++ b/tests/mir-opt/building/issue_49232.main.built.after.mir
@@ -24,7 +24,7 @@ fn main() -> () {
StorageLive(_2);
StorageLive(_3);
_3 = const true;
- FakeRead(ForMatchedPlace(None), _3);
+ PlaceMention(_3);
switchInt(_3) -> [0: bb3, otherwise: bb4];
}
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
index ae159f7e1..00e666ed9 100644
--- a/tests/mir-opt/building/logical_or_in_conditional.rs
+++ b/tests/mir-opt/building/logical_or_in_conditional.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -Z validate-mir
#![feature(let_chains)]
struct Droppy(u8);
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
index 096aaec4a..7407e7a8b 100644
--- 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
@@ -23,7 +23,7 @@ fn test_complex() -> () {
}
bb1: {
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb2, otherwise: bb3];
}
@@ -151,7 +151,7 @@ fn test_complex() -> () {
}
bb25: {
- FakeRead(ForMatchedPlace(None), _12);
+ PlaceMention(_12);
_13 = discriminant(_12);
switchInt(move _13) -> [1: bb27, otherwise: bb26];
}
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 9f64a23f3..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
@@ -26,7 +26,7 @@ fn full_tested_match() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<i32>::Some(const 42_i32);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -45,6 +45,7 @@ fn full_tested_match() -> () {
}
bb4: {
+ FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
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 89f9bafb6..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
@@ -26,7 +26,7 @@ fn full_tested_match2() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<i32>::Some(const 42_i32);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_3 = discriminant(_2);
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -51,6 +51,7 @@ fn full_tested_match2() -> () {
}
bb4: {
+ FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
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 9a2d89c48..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
@@ -37,7 +37,7 @@ fn main() -> () {
StorageLive(_1);
StorageLive(_2);
_2 = Option::<i32>::Some(const 1_i32);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
_4 = discriminant(_2);
switchInt(move _4) -> [1: bb2, otherwise: bb1];
}
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 fed5e68c3..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,10 +1,10 @@
// 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: ();
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/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/simple_match.match_bool.built.after.mir
index c89ea2b6c..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
@@ -5,7 +5,7 @@ fn match_bool(_1: bool) -> usize {
let mut _0: usize;
bb0: {
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
switchInt(_1) -> [0: bb2, otherwise: bb1];
}
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.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.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 9b17b4b63..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
@@ -23,6 +23,6 @@ fn main() -> () {
}
}
-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 f5ea78aec..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;
- let mut _0: *const &u8;
- let mut _2: *const &u8;
- let mut _3: *const &u8;
- scope 1 (inlined generic_cast::<&u8, &u8>) {
- debug x => _1;
- }
-
- bb0: {
- StorageLive(_2);
- StorageLive(_3);
- _3 = _1;
-- _2 = _3 as *const &u8 (PtrToPtr);
-+ _2 = _3;
- StorageDead(_3);
- _0 = _2;
- StorageDead(_2);
- return;
- }
- }
-
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 2084f44f2..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;
- let mut _0: *const &u8;
- scope 1 (inlined generic_cast::<&u8, &u8>) {
- debug x => _1;
- }
-
- bb0: {
- _0 = _1;
- return;
- }
-}
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 f0c35fe97..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;
- let mut _0: *const u8;
- let mut _2: *mut u8;
-
- bb0: {
- StorageLive(_2);
- _2 = _1 as *mut u8 (PtrToPtr);
- _0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer));
- StorageDead(_2);
- return;
- }
-}
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_clone_of_primitives.rs b/tests/mir-opt/combine_clone_of_primitives.rs
deleted file mode 100644
index c19f9ee10..000000000
--- a/tests/mir-opt/combine_clone_of_primitives.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// unit-test: InstSimplify
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-
-// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
-
-#[derive(Clone)]
-struct MyThing<T> {
- v: T,
- i: u64,
- a: [f32; 3],
-}
-
-fn main() {
- let x = MyThing::<i16> { v: 2, i: 3, a: [0.0; 3] };
- let y = x.clone();
-
- assert_eq!(y.v, 2);
- assert_eq!(y.i, 3);
- assert_eq!(y.a, [0.0; 3]);
-}
diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/combine_transmutes.rs
deleted file mode 100644
index 403f9356c..000000000
--- a/tests/mir-opt/combine_transmutes.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// unit-test: InstSimplify
-// compile-flags: -C panic=abort
-
-#![crate_type = "lib"]
-#![feature(core_intrinsics)]
-#![feature(custom_mir)]
-
-use std::intrinsics::mir::*;
-use std::mem::{MaybeUninit, ManuallyDrop, transmute};
-
-// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff
-pub unsafe fn identity_transmutes() {
- // These are nops and should be removed
- let _a = transmute::<i32, i32>(1);
- let _a = transmute::<Vec<i32>, Vec<i32>>(Vec::new());
-}
-
-#[custom_mir(dialect = "runtime", phase = "initial")]
-// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff
-pub unsafe fn integer_transmutes() {
- mir! {
- {
- let A = CastTransmute::<i32, u32>(1); // Can be a cast
- let B = CastTransmute::<i32, i64>(1); // UB
- let C = CastTransmute::<u64, i64>(1); // Can be a cast
- let D = CastTransmute::<u64, u32>(1); // UB
- let E = CastTransmute::<isize, usize>(1); // Can be a cast
- Return()
- }
- }
-}
-
-// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff
-pub unsafe fn adt_transmutes() {
- 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));
- let _a: u32 = transmute(Union32 { i32: 0 });
- let _a: i32 = transmute(Union32 { u32: 0 });
- let _a: ManuallyDrop<String> = transmute(MaybeUninit::<String>::uninit());
-}
-
-pub union Union32 { u32: u32, i32: i32 }
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 8c8e69595..f20bfef8c 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&str])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,43 +17,43 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc19─╼ 03 00 00 00 │ ╾──╼....
+ALLOC9 (static: FOO, size: 8, align: 4) {
+ ╾ALLOC0╼ 03 00 00 00 │ ╾──╼....
}
-alloc19 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc6──╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc10─╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc15─╼ 03 00 00 00 │ ....*...╾──╼....
+ALLOC0 (size: 48, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC1╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾ALLOC2╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ 03 00 00 00 │ ....*...╾──╼....
}
-alloc6 (size: 0, align: 4) {}
+ALLOC1 (size: 0, align: 4) {}
-alloc10 (size: 16, align: 4) {
- ╾─alloc9──╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ALLOC2 (size: 16, align: 4) {
+ ╾ALLOC4╼ 03 00 00 00 ╾ALLOC5╼ 03 00 00 00 │ ╾──╼....╾──╼....
}
-alloc9 (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
}
-alloc15 (size: 24, align: 4) {
- 0x00 │ ╾─alloc14─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼....
- 0x10 │ ╾─alloc17─╼ 04 00 00 00 │ ╾──╼....
+ALLOC3 (size: 24, align: 4) {
+ 0x00 │ ╾ALLOC6╼ 03 00 00 00 ╾ALLOC7╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ 0x10 │ ╾ALLOC8╼ 04 00 00 00 │ ╾──╼....
}
-alloc14 (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 e22547032..263cae2f3 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&str])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,47 +17,47 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc19───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC9 (static: FOO, size: 16, align: 8) {
+ ╾ALLOC0╼ 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╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc10───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc15───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾ALLOC2╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc6 (size: 0, align: 8) {}
+ALLOC1 (size: 0, align: 8) {}
-alloc10 (size: 32, align: 8) {
- 0x00 │ ╾───────alloc9────────╼ 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╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾ALLOC5╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc9 (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
}
-alloc15 (size: 48, align: 8) {
- 0x00 │ ╾───────alloc14───────╼ 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╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾ALLOC7╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x20 │ ╾ALLOC8╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc14 (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 c5f6902b4..713abb264 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&u8])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,42 +17,42 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc23─╼ 03 00 00 00 │ ╾──╼....
+ALLOC9 (static: FOO, size: 8, align: 4) {
+ ╾ALLOC0╼ 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╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾ALLOC2╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ 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╼ ╾ALLOC5╼ │ ╾──╼╾──╼
}
-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╼ ╾ALLOC7╼ ╾ALLOC8+0x2╼ │ ╾──╼╾──╼╾──╼
}
-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 b95b8c787..e9d61ef12 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&[(Option<i32>, &[&u8])]};
+ _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,45 +17,45 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ALLOC9 (static: FOO, size: 16, align: 8) {
+ ╾ALLOC0╼ 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╼ │ ....░░░░╾──────╼
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╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾ALLOC3╼ │ ....*...╾──────╼
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╼ ╾ALLOC5╼ │ ╾──────╼╾──────╼
}
-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╼ ╾ALLOC7╼ │ ╾──────╼╾──────╼
+ 0x10 │ ╾ALLOC8+0x2╼ │ ╾──────╼
}
-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 e172c7540..c18c067c7 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&Packed};
+ _2 = const {ALLOC4: &&Packed};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,31 +17,31 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 4, align: 4) {
- ╾─alloc12─╼ │ ╾──╼
+ALLOC4 (static: FOO, size: 4, align: 4) {
+ ╾ALLOC0╼ │ ╾──╼
}
-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╼ │ ............╾──╼
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╼ 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 d5feea723..6af0e3cbd 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
@@ -8,7 +8,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &&Packed};
+ _2 = const {ALLOC2: &&Packed};
_1 = (*_2);
StorageDead(_2);
StorageDead(_1);
@@ -17,13 +17,13 @@ fn main() -> () {
}
}
-alloc1 (static: FOO, size: 8, align: 8) {
- ╾───────alloc12───────╼ │ ╾──────╼
+ALLOC2 (static: FOO, size: 8, align: 8) {
+ ╾ALLOC0╼ │ ╾──────╼
}
-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── │ ............╾───
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 │ ................
@@ -31,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╼ │ ─────╼..╾──────╼
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 ed47baa67..87c072795 100644
--- a/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
+++ b/tests/mir-opt/const_debuginfo.main.ConstDebugInfo.diff
@@ -8,8 +8,8 @@
let mut _6: u8;
let mut _7: u8;
let mut _8: u8;
- let mut _12: u32;
- let mut _13: u32;
+ let mut _14: u32;
+ let mut _15: u32;
scope 1 {
- debug x => _1;
+ debug x => const 1_u8;
@@ -29,29 +29,19 @@
scope 5 {
- debug s => _9;
+ debug s => const "hello, world!";
- let _14: bool;
- let _15: bool;
- let _16: u32;
+ let _10: (bool, bool, u32);
scope 6 {
-- debug ((f: (bool, bool, u32)).0: bool) => _14;
-- debug ((f: (bool, bool, u32)).1: bool) => _15;
-- debug ((f: (bool, bool, u32)).2: u32) => _16;
-+ debug ((f: (bool, bool, u32)).0: bool) => const true;
-+ debug ((f: (bool, bool, u32)).1: bool) => const false;
-+ debug ((f: (bool, bool, u32)).2: u32) => const 123_u32;
- let _10: std::option::Option<u16>;
+ debug f => _10;
+ let _11: std::option::Option<u16>;
scope 7 {
- debug o => _10;
- let _17: u32;
- let _18: u32;
+ debug o => _11;
+ let _12: Point;
scope 8 {
-- debug ((p: Point).0: u32) => _17;
-- debug ((p: Point).1: u32) => _18;
-+ debug ((p: Point).0: u32) => const 32_u32;
-+ debug ((p: Point).1: u32) => const 32_u32;
- let _11: u32;
+- debug p => _12;
++ debug p => const Point {{ x: 32_u32, y: 32_u32 }};
+ let _13: u32;
scope 9 {
-- debug a => _11;
+- debug a => _13;
+ debug a => const 64_u32;
}
}
@@ -64,36 +54,57 @@
}
bb0: {
+ 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(_14);
- StorageLive(_15);
- StorageLive(_16);
- _14 = const true;
- _15 = const false;
- _16 = const 123_u32;
StorageLive(_10);
- _10 = Option::<u16>::Some(const 99_u16);
- _17 = const 32_u32;
- _18 = const 32_u32;
+ _10 = (const true, const false, const 123_u32);
StorageLive(_11);
- _11 = const 64_u32;
+ _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(_14);
- StorageDead(_15);
- StorageDead(_16);
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.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.rs b/tests/mir-opt/const_goto_const_eval_fail.rs
index b2357663a..869f91600 100644
--- a/tests/mir-opt/const_goto_const_eval_fail.rs
+++ b/tests/mir-opt/const_goto_const_eval_fail.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(min_const_generics)]
#![crate_type = "lib"]
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 5b8d3ca78..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
@@ -7,7 +7,7 @@ promoted[0] in BAR: &[&i32; 1] = {
let mut _3: &i32;
bb0: {
- _3 = const {alloc1: &i32};
+ _3 = const {ALLOC0: &i32};
_2 = &(*_3);
_1 = [move _2];
_0 = &_1;
@@ -15,6 +15,6 @@ promoted[0] in BAR: &[&i32; 1] = {
}
}
-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 14d2d7fc8..4a93db3fc 100644
--- a/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.BAR.PromoteTemps.diff
@@ -16,7 +16,7 @@
- StorageLive(_3);
- StorageLive(_4);
- StorageLive(_5);
-- _5 = const {alloc1: &i32};
+- _5 = const {ALLOC0: &i32};
- _4 = &(*_5);
- _3 = [move _4];
- _2 = &_3;
@@ -40,7 +40,7 @@
}
- }
-
-- 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.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 85355389b..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
@@ -7,7 +7,7 @@ promoted[0] in FOO: &[&i32; 1] = {
let mut _3: *const i32;
bb0: {
- _3 = const {alloc3: *const i32};
+ _3 = const {ALLOC0: *const i32};
_2 = &(*_3);
_1 = [move _2];
_0 = &_1;
@@ -15,4 +15,4 @@ promoted[0] in FOO: &[&i32; 1] = {
}
}
-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 ffdd195ec..21d21b0ee 100644
--- a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
@@ -18,7 +18,7 @@
- StorageLive(_3);
- StorageLive(_4);
- StorageLive(_5);
-- _5 = const {alloc3: *const i32};
+- _5 = const {ALLOC0: *const i32};
- _4 = &(*_5);
- _3 = [move _4];
- _2 = &_3;
@@ -42,5 +42,5 @@
}
}
-
-- 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.rs b/tests/mir-opt/const_prop/address_of_pair.rs
index 43dc9bae6..169469a07 100644
--- a/tests/mir-opt/const_prop/address_of_pair.rs
+++ b/tests/mir-opt/const_prop/address_of_pair.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR address_of_pair.fn0.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/aggregate.rs b/tests/mir-opt/const_prop/aggregate.rs
index 62cd3dd68..2e043af08 100644
--- a/tests/mir-opt/const_prop/aggregate.rs
+++ b/tests/mir-opt/const_prop/aggregate.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -O
diff --git a/tests/mir-opt/const_prop/array_index.rs b/tests/mir-opt/const_prop/array_index.rs
index f85d23b97..3bd232165 100644
--- a/tests/mir-opt/const_prop/array_index.rs
+++ b/tests/mir-opt/const_prop/array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
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 963084bf7..ab41f64a5 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,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
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 9d7d2aa10..e747b21cf 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,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
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 d6b1a93f3..38c97a4cf 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,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/boolean_identities.rs b/tests/mir-opt/const_prop/boolean_identities.rs
index c7b609949..781cce8c7 100644
--- a/tests/mir-opt/const_prop/boolean_identities.rs
+++ b/tests/mir-opt/const_prop/boolean_identities.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O -Zmir-opt-level=4
diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs
index 78599174b..c6807ece1 100644
--- a/tests/mir-opt/const_prop/boxes.rs
+++ b/tests/mir-opt/const_prop/boxes.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/const_prop/cast.rs b/tests/mir-opt/const_prop/cast.rs
index 984086eda..3d543bada 100644
--- a/tests/mir-opt/const_prop/cast.rs
+++ b/tests/mir-opt/const_prop/cast.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR cast.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
index c2fd7f65f..5a958cc7a 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-abort.diff
@@ -26,7 +26,7 @@
}
+ }
+
-+ alloc3 (size: 8, align: 4) {
++ 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
index 21a31f9ab..ab48186ae 100644
--- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff
@@ -26,7 +26,7 @@
}
+ }
+
-+ alloc3 (size: 8, align: 4) {
++ 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 fd40876cb..6a53aced0 100644
--- a/tests/mir-opt/const_prop/checked_add.rs
+++ b/tests/mir-opt/const_prop/checked_add.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
index c92831f92..5bd4731bf 100644
--- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
+++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
#[inline(never)]
diff --git a/tests/mir-opt/const_prop/control_flow_simplification.rs b/tests/mir-opt/const_prop/control_flow_simplification.rs
index 21d727b3e..5fc13e202 100644
--- a/tests/mir-opt/const_prop/control_flow_simplification.rs
+++ b/tests/mir-opt/const_prop/control_flow_simplification.rs
@@ -1,3 +1,4 @@
+// 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.rs b/tests/mir-opt/const_prop/discriminant.rs
index fdd67ca8a..11405f38b 100644
--- a/tests/mir-opt/const_prop/discriminant.rs
+++ b/tests/mir-opt/const_prop/discriminant.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O
diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
index c0efc8730..530cfc653 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff
@@ -31,7 +31,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ 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
index 2aee6f164..08cf72e47 100644
--- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff
@@ -31,7 +31,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ 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 72af6cd95..0e6e1d78d 100644
--- a/tests/mir-opt/const_prop/indirect.rs
+++ b/tests/mir-opt/const_prop/indirect.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
index 4eafb8d09..4eafb8d09 100644
--- a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
+++ b/tests/mir-opt/const_prop/indirect_mutation.bar.ConstProp.diff
diff --git a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
index 445d9895d..445d9895d 100644
--- a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
+++ b/tests/mir-opt/const_prop/indirect_mutation.foo.ConstProp.diff
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.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
index 7ba51ccdb..b30deb2a4 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff
@@ -20,6 +20,7 @@
_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);
@@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
+ StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
@@ -37,7 +39,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ 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
index 545b7f22f..47c51196c 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff
@@ -20,6 +20,7 @@
_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);
@@ -29,6 +30,7 @@
bb1: {
- _1 = move (_4.0: u8);
+ _1 = const 0_u8;
+ StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
@@ -37,7 +39,7 @@
}
+ }
+
-+ alloc3 (size: 2, align: 1) {
++ 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 6ebd36412..41989462d 100644
--- a/tests/mir-opt/const_prop/inherit_overflow.rs
+++ b/tests/mir-opt/const_prop/inherit_overflow.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+Inline
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.panic-abort.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
index 18341ba7d..6484b4b67 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-abort.diff
@@ -20,11 +20,11 @@
}
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 00 00 │ ..
+ }
+
-+ alloc7 (size: 2, align: 1) {
++ 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
index 50763c10f..b02f04078 100644
--- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff
@@ -20,11 +20,11 @@
}
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 00 00 │ ..
+ }
+
-+ alloc7 (size: 2, align: 1) {
++ 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 a0242ec63..386c95b5b 100644
--- a/tests/mir-opt/const_prop/issue_66971.rs
+++ b/tests/mir-opt/const_prop/issue_66971.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3
diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
index 015180db8..c1ef453e9 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-abort.diff
@@ -25,15 +25,15 @@
}
+ }
+
-+ alloc12 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc11 (size: 2, align: 1) {
++ ALLOC1 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ 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
index 8e41705c1..53cdcc181 100644
--- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff
@@ -25,15 +25,15 @@
}
+ }
+
-+ alloc12 (size: 2, align: 1) {
++ ALLOC0 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc11 (size: 2, align: 1) {
++ ALLOC1 (size: 2, align: 1) {
+ 01 02 │ ..
+ }
+
-+ alloc8 (size: 2, align: 1) {
++ 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 66b577f5b..2f61298bb 100644
--- a/tests/mir-opt/const_prop/issue_67019.rs
+++ b/tests/mir-opt/const_prop/issue_67019.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Z mir-opt-level=3
diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index d226bd546..d98d166ff 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs
index 7bd30975a..47e15205e 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.rs
+++ b/tests/mir-opt/const_prop/mult_by_zero.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mult_by_zero.test.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs
index 95987ef7f..175d63d46 100644
--- a/tests/mir-opt/const_prop/mutable_variable.rs
+++ b/tests/mir-opt/const_prop/mutable_variable.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mutable_variable.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff
index 56a127ae3..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
@@ -27,11 +27,11 @@
}
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 2a 00 00 00 63 00 00 00 │ *...c...
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ 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..f926771ae 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
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..a81aa7b49 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
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
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 30ea5714a..54a5d9223 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,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
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 ac26f8ef4..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
@@ -23,7 +23,7 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = const {alloc1: *mut u32};
+ _4 = const {ALLOC0: *mut u32};
_3 = (*_4);
_1 = move _3;
StorageDead(_3);
@@ -39,7 +39,7 @@
}
}
- 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..a7aeeccd8 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
static mut STATIC: u32 = 0x42424242;
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
index a1b433716..85bd2b6e7 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-abort.diff
@@ -48,7 +48,7 @@
}
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ 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
index 2dc514194..06e96e57a 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff
@@ -48,7 +48,7 @@
}
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ 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 4e7c0597a..6bdb136a9 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
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
index c73d217ae..711db3d21 100644
--- 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
@@ -8,6 +8,9 @@
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;
@@ -19,6 +22,18 @@
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;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _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];
@@ -37,7 +52,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _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];
@@ -47,7 +62,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _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];
@@ -57,7 +72,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _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];
@@ -65,7 +80,40 @@
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);
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
index 913ffca4a..494581454 100644
--- 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
@@ -8,6 +8,9 @@
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;
@@ -19,6 +22,18 @@
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;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _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];
@@ -37,7 +52,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _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];
@@ -47,7 +62,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _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];
@@ -57,7 +72,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _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];
@@ -65,7 +80,40 @@
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);
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
index 7519331f6..768970a72 100644
--- 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
@@ -8,6 +8,9 @@
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;
@@ -19,6 +22,18 @@
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;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
}
@@ -35,7 +50,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
}
@@ -43,7 +58,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
- _6 = OffsetOf(Delta<T>, [1]);
+ _6 = OffsetOf(Delta<T>, [(0, 1)]);
_5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
}
@@ -51,13 +66,40 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
- _8 = OffsetOf(Delta<T>, [2]);
+ _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);
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
index fd5206e46..04ccd2b36 100644
--- 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
@@ -8,6 +8,9 @@
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;
@@ -19,6 +22,18 @@
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;
+ }
+ }
+ }
}
}
}
@@ -27,7 +42,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
}
@@ -35,7 +50,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
}
@@ -43,7 +58,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
- _6 = OffsetOf(Delta<T>, [1]);
+ _6 = OffsetOf(Delta<T>, [(0, 1)]);
_5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
}
@@ -51,13 +66,40 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
- _8 = OffsetOf(Delta<T>, [2]);
+ _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);
diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs
index 164db5957..2571c3856 100644
--- a/tests/mir-opt/const_prop/offset_of.rs
+++ b/tests/mir-opt/const_prop/offset_of.rs
@@ -1,7 +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;
@@ -27,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
@@ -41,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/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
index 29c455f35..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
@@ -16,12 +16,12 @@
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
- _3 = const {alloc1: &u8};
+ _3 = const {ALLOC0: &u8};
- _2 = (*_3);
+ _2 = const 2_u8;
StorageLive(_4);
StorageLive(_5);
- _5 = const {alloc1: &u8};
+ _5 = const {ALLOC0: &u8};
- _4 = (*_5);
- _1 = Add(move _2, move _4);
+ _4 = const 2_u8;
@@ -36,7 +36,7 @@
}
}
- 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..a8d8cfacc 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.rs
+++ b/tests/mir-opt/const_prop/read_immutable_static.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
static FOO: u8 = 2;
diff --git a/tests/mir-opt/const_prop/ref_deref.rs b/tests/mir-opt/const_prop/ref_deref.rs
index 76e56916a..f2fa024f7 100644
--- a/tests/mir-opt/const_prop/ref_deref.rs
+++ b/tests/mir-opt/const_prop/ref_deref.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR ref_deref.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/ref_deref_project.rs b/tests/mir-opt/const_prop/ref_deref_project.rs
index 04fc7f8da..1b9e0acb2 100644
--- a/tests/mir-opt/const_prop/ref_deref_project.rs
+++ b/tests/mir-opt/const_prop/ref_deref_project.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR ref_deref_project.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs
index 5f6382066..da7de80c5 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.rs
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR reify_fn_ptr.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index fb8b825ee..92194d6bb 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
index 6c9de4764..974a42e50 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-abort.diff
@@ -19,7 +19,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ 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
index 0f079278c..55dbc7002 100644
--- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff
@@ -19,7 +19,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
index c2488f394..f87c26bb0 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-abort.mir
@@ -15,6 +15,6 @@ fn add() -> u32 {
}
}
-alloc5 (size: 8, align: 4) {
+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
index fa0b9c77e..33f975913 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir
@@ -15,6 +15,6 @@ fn add() -> u32 {
}
}
-alloc5 (size: 8, align: 4) {
+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 0576b02a8..1263de793 100644
--- a/tests/mir-opt/const_prop/return_place.rs
+++ b/tests/mir-opt/const_prop/return_place.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
index dfe41e614..9dcddf7c7 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR scalar_literal_propagation.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs
index e91724536..3b551b6b1 100644
--- a/tests/mir-opt/const_prop/slice_len.rs
+++ b/tests/mir-opt/const_prop/slice_len.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+InstSimplify
diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs
index bf708c829..7ec56e11e 100644
--- a/tests/mir-opt/const_prop/switch_int.rs
+++ b/tests/mir-opt/const_prop/switch_int.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
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.unreachable_box.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
index 100982382..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
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -13,7 +14,9 @@
bb0: {
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 100982382..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
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -13,7 +14,9 @@
bb0: {
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/tuple_literal_propagation.main.ConstProp.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
index 988ef7dd2..f19650d5a 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-abort.diff
@@ -31,15 +31,15 @@
}
+ }
+
-+ alloc9 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc8 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc6 (size: 8, align: 4) {
++ 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
index 298446197..67307c423 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff
@@ -31,15 +31,15 @@
}
+ }
+
-+ alloc9 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc8 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 02 00 00 00 │ ........
+ }
+
-+ alloc6 (size: 8, align: 4) {
++ 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 5890a343f..e0bc6e1be 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR tuple_literal_propagation.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs
index 595a94b88..39081c355 100644
--- a/tests/mir-opt/const_prop/while_let_loops.rs
+++ b/tests/mir-opt/const_prop/while_let_loops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: ConstProp
// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff
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.rs b/tests/mir-opt/copy-prop/borrowed_local.rs
index bf94dc57d..c6b8ad357 100644
--- a/tests/mir-opt/copy-prop/borrowed_local.rs
+++ b/tests/mir-opt/copy-prop/borrowed_local.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/branch.rs b/tests/mir-opt/copy-prop/branch.rs
index c8af1aa7b..278508957 100644
--- a/tests/mir-opt/copy-prop/branch.rs
+++ b/tests/mir-opt/copy-prop/branch.rs
@@ -1,3 +1,4 @@
+// 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
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..2970f5f0b
--- /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)
+ }
+ 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.rs b/tests/mir-opt/copy-prop/copy_propagation_arg.rs
index 671860da5..83bbefe09 100644
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.rs
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.rs
@@ -1,3 +1,4 @@
+// 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)
diff --git a/tests/mir-opt/copy-prop/custom_move_arg.rs b/tests/mir-opt/copy-prop/custom_move_arg.rs
index d1c5ffdff..2077874ee 100644
--- a/tests/mir-opt/copy-prop/custom_move_arg.rs
+++ b/tests/mir-opt/copy-prop/custom_move_arg.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/cycle.rs b/tests/mir-opt/copy-prop/cycle.rs
index 56ec75397..58e049fde 100644
--- a/tests/mir-opt/copy-prop/cycle.rs
+++ b/tests/mir-opt/copy-prop/cycle.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang CopyProp, and result in reasonable code.
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.rs b/tests/mir-opt/copy-prop/dead_stores_79191.rs
index 4260d35b1..81306ab61 100644
--- a/tests/mir-opt/copy-prop/dead_stores_79191.rs
+++ b/tests/mir-opt/copy-prop/dead_stores_79191.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/dead_stores_better.rs b/tests/mir-opt/copy-prop/dead_stores_better.rs
index c5962db6a..7addf6af2 100644
--- a/tests/mir-opt/copy-prop/dead_stores_better.rs
+++ b/tests/mir-opt/copy-prop/dead_stores_better.rs
@@ -1,3 +1,4 @@
+// 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.rs b/tests/mir-opt/copy-prop/issue_107511.rs
index ce6fcc17b..53fd93662 100644
--- a/tests/mir-opt/copy-prop/issue_107511.rs
+++ b/tests/mir-opt/copy-prop/issue_107511.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/move_arg.rs b/tests/mir-opt/copy-prop/move_arg.rs
index a3a04e57b..fc2932a65 100644
--- a/tests/mir-opt/copy-prop/move_arg.rs
+++ b/tests/mir-opt/copy-prop/move_arg.rs
@@ -1,3 +1,4 @@
+// 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.rs b/tests/mir-opt/copy-prop/move_projection.rs
index f94addb56..8629d535b 100644
--- a/tests/mir-opt/copy-prop/move_projection.rs
+++ b/tests/mir-opt/copy-prop/move_projection.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: CopyProp
diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs
index 753787089..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,4 @@
+// skip-filecheck
// unit-test: CopyProp
//
// This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB
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.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.rs b/tests/mir-opt/copy-prop/reborrow.rs
index c37ba5e5c..57c4fb8ad 100644
--- a/tests/mir-opt/copy-prop/reborrow.rs
+++ b/tests/mir-opt/copy-prop/reborrow.rs
@@ -1,3 +1,4 @@
+// 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/coroutine_storage_dead_unwind.rs b/tests/mir-opt/coroutine_storage_dead_unwind.rs
new file mode 100644
index 000000000..253be1ff6
--- /dev/null
+++ b/tests/mir-opt/coroutine_storage_dead_unwind.rs
@@ -0,0 +1,30 @@
+// skip-filecheck
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+// 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(coroutines, coroutine_trait)]
+
+struct Foo(i32);
+
+impl Drop for Foo {
+ fn drop(&mut self) {}
+}
+
+struct Bar(i32);
+
+fn take<T>(_x: T) {}
+
+// EMIT_MIR coroutine_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
+fn main() {
+ let _gen = || {
+ let a = Foo(5);
+ let b = Bar(6);
+ yield;
+ take(a);
+ take(b);
+ };
+}
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..17b99c87c
--- /dev/null
+++ b/tests/mir-opt/coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
@@ -0,0 +1,86 @@
+// 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);
+ 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/coroutine_tiny.rs b/tests/mir-opt/coroutine_tiny.rs
new file mode 100644
index 000000000..0fd785b28
--- /dev/null
+++ b/tests/mir-opt/coroutine_tiny.rs
@@ -0,0 +1,27 @@
+// 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(coroutines, coroutine_trait)]
+
+struct HasDrop;
+
+impl Drop for HasDrop {
+ fn drop(&mut self) {}
+}
+
+fn callee() {}
+
+// EMIT_MIR coroutine_tiny.main-{closure#0}.coroutine_resume.0.mir
+fn main() {
+ let _gen = |_x: u8| {
+ let _d = HasDrop;
+ loop {
+ yield;
+ callee();
+ }
+ };
+}
diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs
index ddb3646ca..3d420f930 100644
--- a/tests/mir-opt/dataflow-const-prop/array_index.rs
+++ b/tests/mir-opt/dataflow-const-prop/array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
index 9e911e85b..2605c7019 100644
--- a/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
+++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR boolean_identities.test.DataflowConstProp.diff
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.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff
index 2f1a70f32..4569ffe48 100644
--- 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
@@ -43,7 +43,7 @@
- _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 = CheckedAdd(const 1_i32, 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];
}
@@ -60,7 +60,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 = CheckedAdd(const i32::MAX, const 1_i32);
++ _10 = const (i32::MIN, true);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind unreachable];
}
@@ -76,5 +76,13 @@
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
index 0d8a9aca3..aa7e404eb 100644
--- 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
@@ -43,7 +43,7 @@
- _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 = CheckedAdd(const 1_i32, 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];
}
@@ -60,7 +60,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 = CheckedAdd(const i32::MAX, const 1_i32);
++ _10 = const (i32::MIN, true);
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind continue];
}
@@ -76,5 +76,13 @@
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 1c301460f..f7fac8890 100644
--- a/tests/mir-opt/dataflow-const-prop/checked.rs
+++ b/tests/mir-opt/dataflow-const-prop/checked.rs
@@ -1,6 +1,7 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// 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
index b9b46f16a..9bfd46231 100644
--- 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
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _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];
@@ -105,15 +105,15 @@
}
+ }
+
-+ alloc11 (size: 8, align: 4) {
++ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc10 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ 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
index 93b18f23e..dba50b142 100644
--- 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
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _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];
@@ -109,15 +109,15 @@
}
+ }
+
-+ alloc11 (size: 8, align: 4) {
++ ALLOC2 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc10 (size: 8, align: 4) {
++ ALLOC1 (size: 8, align: 4) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
-+ alloc7 (size: 8, align: 4) {
++ 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
index 3d3af6285..33fe4628d 100644
--- 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
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _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];
@@ -105,15 +105,15 @@
}
+ }
+
-+ alloc11 (size: 16, align: 8) {
++ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc10 (size: 16, align: 8) {
++ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc7 (size: 16, align: 8) {
++ 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
index 1933f9baf..b2d561911 100644
--- 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
@@ -87,13 +87,13 @@
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
-+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
++ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
++ _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];
@@ -109,15 +109,15 @@
}
+ }
+
-+ alloc11 (size: 16, align: 8) {
++ ALLOC2 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc10 (size: 16, align: 8) {
++ ALLOC1 (size: 16, align: 8) {
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
+ }
+
-+ alloc7 (size: 16, align: 8) {
++ 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
index 7862c23da..1751b0de2 100644
--- 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
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _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];
@@ -97,15 +97,15 @@
}
}
- alloc11 (size: 8, align: 4) {
+ ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc10 (size: 8, align: 4) {
+ ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc7 (size: 8, align: 4) {
+ 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
index bd4150ebb..858a9d33d 100644
--- 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
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _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];
@@ -101,15 +101,15 @@
}
}
- alloc11 (size: 8, align: 4) {
+ ALLOC2 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc10 (size: 8, align: 4) {
+ ALLOC1 (size: 8, align: 4) {
01 00 00 00 00 00 00 00 │ ........
}
- alloc7 (size: 8, align: 4) {
+ 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
index 312fc7b7a..517070420 100644
--- 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
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _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];
@@ -97,15 +97,15 @@
}
}
- alloc11 (size: 16, align: 8) {
+ ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc10 (size: 16, align: 8) {
+ ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc7 (size: 16, align: 8) {
+ 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
index 3227d8b84..9141a6c67 100644
--- 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
@@ -81,11 +81,11 @@
StorageDead(_6);
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
StorageDead(_5);
- _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc7, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
+ _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: alloc10, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, 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: const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: alloc11, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) };
+ _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];
@@ -101,15 +101,15 @@
}
}
- alloc11 (size: 16, align: 8) {
+ ALLOC2 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc10 (size: 16, align: 8) {
+ ALLOC1 (size: 16, align: 8) {
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
}
- alloc7 (size: 16, align: 8) {
+ 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
index dfeccd3eb..1bb052736 100644
--- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
+++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+ConstProp,+Inline
// ignore-debug assertions change the output MIR
diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs
index 5a10e9e88..e35c0e6e8 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.rs
+++ b/tests/mir-opt/dataflow-const-prop/enum.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
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
index 3946e7c7d..798b0c041 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff
@@ -23,7 +23,8 @@
bb0: {
StorageLive(_1);
- _1 = E::V1(const 0_i32);
+- _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];
@@ -59,5 +60,9 @@
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
index 3946e7c7d..798b0c041 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff
@@ -23,7 +23,8 @@
bb0: {
StorageLive(_1);
- _1 = E::V1(const 0_i32);
+- _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];
@@ -59,5 +60,9 @@
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.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
index ae8b44c95..d502b1982 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff
@@ -43,8 +43,9 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &E};
- _1 = (*_2);
+ _2 = const {ALLOC1: &E};
+- _1 = (*_2);
++ _1 = const E::V1(0_i32);
StorageDead(_2);
StorageLive(_3);
- _4 = discriminant(_1);
@@ -78,7 +79,7 @@
bb4: {
StorageLive(_7);
StorageLive(_8);
- _8 = const {alloc2: &&E};
+ _8 = const {ALLOC2: &&E};
_7 = (*_8);
StorageDead(_8);
StorageLive(_9);
@@ -110,17 +111,21 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
}
- alloc2 (static: RC, size: 4, align: 4) {
- ╾─alloc14─╼ │ ╾──╼
+ ALLOC2 (static: RC, size: 4, align: 4) {
+ ╾ALLOC0╼ │ ╾──╼
}
- alloc14 (size: 8, align: 4) {
+ ALLOC0 (size: 8, align: 4) {
01 00 00 00 04 00 00 00 │ ........
}
- alloc1 (static: statics::C, size: 8, align: 4) {
+ 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
index 63799b3ba..5d69572b5 100644
--- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff
@@ -43,8 +43,9 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = const {alloc1: &E};
- _1 = (*_2);
+ _2 = const {ALLOC1: &E};
+- _1 = (*_2);
++ _1 = const E::V1(0_i32);
StorageDead(_2);
StorageLive(_3);
- _4 = discriminant(_1);
@@ -78,7 +79,7 @@
bb4: {
StorageLive(_7);
StorageLive(_8);
- _8 = const {alloc2: &&E};
+ _8 = const {ALLOC2: &&E};
_7 = (*_8);
StorageDead(_8);
StorageLive(_9);
@@ -110,17 +111,21 @@
StorageDead(_1);
return;
}
++ }
++
++ ALLOC3 (size: 8, align: 4) {
++ 00 00 00 00 00 00 00 00 │ ........
}
- alloc2 (static: RC, size: 8, align: 8) {
- ╾───────alloc14───────╼ │ ╾──────╼
+ ALLOC2 (static: RC, size: 8, align: 8) {
+ ╾ALLOC0╼ │ ╾──────╼
}
- alloc14 (size: 8, align: 4) {
+ ALLOC0 (size: 8, align: 4) {
01 00 00 00 04 00 00 00 │ ........
}
- alloc1 (static: statics::C, size: 8, align: 4) {
+ 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.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.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff
index 9a68d3b51..2d4591ea2 100644
--- 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
@@ -20,20 +20,26 @@
_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 = CheckedAdd(const u8::MAX, const 1_u8);
++ _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
index c1d281ab7..e99ac782a 100644
--- 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
@@ -20,20 +20,26 @@
_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 = CheckedAdd(const u8::MAX, const 1_u8);
++ _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 964c58966..664cbcb2c 100644
--- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
+++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.rs
@@ -1,3 +1,4 @@
+// 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.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.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
index af13c7d10..d611a54ba 100644
--- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs
+++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
index dbea14804..16a45c8e9 100644
--- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
+++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
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
index c61414b65..f8f891750 100644
--- 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
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _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];
@@ -37,7 +37,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _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];
@@ -47,7 +47,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _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];
@@ -57,7 +57,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _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];
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
index 0c3939a34..d4f8cb667 100644
--- 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
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
-- _2 = OffsetOf(Alpha, [0]);
+- _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];
@@ -37,7 +37,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
-- _4 = OffsetOf(Alpha, [1]);
+- _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];
@@ -47,7 +47,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Alpha, [2, 0]);
+- _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];
@@ -57,7 +57,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Alpha, [2, 1]);
+- _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];
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
index d54d46870..7f166e4fa 100644
--- 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
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
}
@@ -35,7 +35,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
}
@@ -43,7 +43,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Delta<T>, [1]);
+- _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];
@@ -53,7 +53,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Delta<T>, [2]);
+- _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];
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
index 6032a2274..38ad6f798 100644
--- 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
@@ -27,7 +27,7 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = OffsetOf(Gamma<T>, [0]);
+ _2 = OffsetOf(Gamma<T>, [(0, 0)]);
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
}
@@ -35,7 +35,7 @@
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = OffsetOf(Gamma<T>, [1]);
+ _4 = OffsetOf(Gamma<T>, [(0, 1)]);
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
}
@@ -43,7 +43,7 @@
StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
-- _6 = OffsetOf(Delta<T>, [1]);
+- _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];
@@ -53,7 +53,7 @@
StorageDead(_6);
StorageLive(_7);
StorageLive(_8);
-- _8 = OffsetOf(Delta<T>, [2]);
+- _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];
diff --git a/tests/mir-opt/dataflow-const-prop/offset_of.rs b/tests/mir-opt/dataflow-const-prop/offset_of.rs
index ccc90790e..e71b3f59e 100644
--- a/tests/mir-opt/dataflow-const-prop/offset_of.rs
+++ b/tests/mir-opt/dataflow-const-prop/offset_of.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
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 4ac0a5b32..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,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs
index 9fa353e44..b82448194 100644
--- a/tests/mir-opt/dataflow-const-prop/repeat.rs
+++ b/tests/mir-opt/dataflow-const-prop/repeat.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH
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 4b1a8d932..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
@@ -17,7 +17,8 @@
bb0: {
StorageLive(_1);
- _1 = I32(const 0_i32);
+- _1 = I32(const 0_i32);
++ _1 = const I32(0_i32);
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
@@ -31,12 +32,20 @@
StorageDead(_5);
StorageDead(_4);
- _2 = I32(move _3);
-+ _2 = I32(const 0_i32);
++ _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.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.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.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
index 87842f347..68aff5286 100644
--- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
+++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs
@@ -1,3 +1,4 @@
+// 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
diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs
index 41367e484..86266ef5d 100644
--- a/tests/mir-opt/dataflow-const-prop/slice_len.rs
+++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+InstSimplify
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
index 2de6ba307..8499d0a89 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff
@@ -7,13 +7,24 @@
let mut _3: i32;
let mut _5: i32;
let mut _6: i32;
- let mut _11: BigStruct;
- let mut _16: &&BigStruct;
- let mut _17: &BigStruct;
- let mut _18: &BigStruct;
- let mut _19: &BigStruct;
- let mut _20: &BigStruct;
- let mut _21: &BigStruct;
+ 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;
@@ -22,24 +33,44 @@
let _4: i32;
scope 3 {
debug b => _4;
- let _7: S;
- let _8: u8;
- let _9: f32;
- let _10: S;
+ let _7: f32;
+ let _8: std::option::Option<S>;
+ let _9: &[f32];
scope 4 {
debug a => _7;
debug b => _8;
debug c => _9;
- debug d => _10;
- let _12: S;
- let _13: u8;
- let _14: f32;
- let _15: S;
+ let _11: f32;
+ let _12: std::option::Option<S>;
+ let _13: &[f32];
scope 5 {
- debug a => _12;
- debug b => _13;
- debug c => _14;
- debug d => _15;
+ 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;
+ }
+ }
+ }
+ }
}
}
}
@@ -48,7 +79,8 @@
bb0: {
StorageLive(_1);
- _1 = S(const 1_i32);
+- _1 = S(const 1_i32);
++ _1 = const S(1_i32);
StorageLive(_2);
StorageLive(_3);
- _3 = (_1.0: i32);
@@ -68,47 +100,95 @@
+ _4 = const 6_i32;
StorageDead(_6);
StorageDead(_5);
- StorageLive(_11);
- _11 = const _;
+ StorageLive(_10);
+ _10 = const _;
StorageLive(_7);
-- _7 = (_11.0: S);
-+ _7 = const S(1_i32);
+- _7 = (_10.0: f32);
++ _7 = const 4f32;
StorageLive(_8);
-- _8 = (_11.1: u8);
-+ _8 = const 5_u8;
+- _8 = (_10.1: std::option::Option<S>);
++ _8 = const Option::<S>::Some(S(1_i32));
StorageLive(_9);
-- _9 = (_11.2: f32);
-+ _9 = const 7f32;
- StorageLive(_10);
-- _10 = (_11.3: S);
-+ _10 = const S(13_i32);
- StorageDead(_11);
- StorageLive(_16);
- _16 = const {alloc1: &&BigStruct};
- _17 = deref_copy (*_16);
+ _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);
- _18 = deref_copy (*_16);
-- _12 = ((*_18).0: S);
-+ _12 = const S(1_i32);
+ _33 = deref_copy (*_14);
+ _12 = ((*_33).1: std::option::Option<S>);
StorageLive(_13);
- _19 = deref_copy (*_16);
-- _13 = ((*_19).1: u8);
-+ _13 = const 5_u8;
- StorageLive(_14);
- _20 = deref_copy (*_16);
-- _14 = ((*_20).2: f32);
-+ _14 = const 7f32;
+ _34 = deref_copy (*_14);
+ _13 = ((*_34).2: &[f32]);
+ StorageDead(_14);
StorageLive(_15);
- _21 = deref_copy (*_16);
-- _15 = ((*_21).3: S);
-+ _15 = const S(13_i32);
+ 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(_14);
StorageDead(_13);
StorageDead(_12);
- StorageDead(_10);
+ StorageDead(_11);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
@@ -117,13 +197,51 @@
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╼ │ ╾──╼
+ }
+
+ ALLOC0 (size: 20, align: 4) {
+ 0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1╼ 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╼ │ ╾──╼
}
- alloc1 (static: STAT, size: 4, align: 4) {
- ╾─alloc15─╼ │ ╾──╼
+ ALLOC2 (size: 20, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3╼ 01 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 10 41 │ ...A
}
- alloc15 (size: 16, align: 4) {
- 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ 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
index 71a28f216..01ec3f623 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
+++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff
@@ -7,13 +7,24 @@
let mut _3: i32;
let mut _5: i32;
let mut _6: i32;
- let mut _11: BigStruct;
- let mut _16: &&BigStruct;
- let mut _17: &BigStruct;
- let mut _18: &BigStruct;
- let mut _19: &BigStruct;
- let mut _20: &BigStruct;
- let mut _21: &BigStruct;
+ 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;
@@ -22,24 +33,44 @@
let _4: i32;
scope 3 {
debug b => _4;
- let _7: S;
- let _8: u8;
- let _9: f32;
- let _10: S;
+ let _7: f32;
+ let _8: std::option::Option<S>;
+ let _9: &[f32];
scope 4 {
debug a => _7;
debug b => _8;
debug c => _9;
- debug d => _10;
- let _12: S;
- let _13: u8;
- let _14: f32;
- let _15: S;
+ let _11: f32;
+ let _12: std::option::Option<S>;
+ let _13: &[f32];
scope 5 {
- debug a => _12;
- debug b => _13;
- debug c => _14;
- debug d => _15;
+ 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;
+ }
+ }
+ }
+ }
}
}
}
@@ -48,7 +79,8 @@
bb0: {
StorageLive(_1);
- _1 = S(const 1_i32);
+- _1 = S(const 1_i32);
++ _1 = const S(1_i32);
StorageLive(_2);
StorageLive(_3);
- _3 = (_1.0: i32);
@@ -68,47 +100,95 @@
+ _4 = const 6_i32;
StorageDead(_6);
StorageDead(_5);
- StorageLive(_11);
- _11 = const _;
+ StorageLive(_10);
+ _10 = const _;
StorageLive(_7);
-- _7 = (_11.0: S);
-+ _7 = const S(1_i32);
+- _7 = (_10.0: f32);
++ _7 = const 4f32;
StorageLive(_8);
-- _8 = (_11.1: u8);
-+ _8 = const 5_u8;
+- _8 = (_10.1: std::option::Option<S>);
++ _8 = const Option::<S>::Some(S(1_i32));
StorageLive(_9);
-- _9 = (_11.2: f32);
-+ _9 = const 7f32;
- StorageLive(_10);
-- _10 = (_11.3: S);
-+ _10 = const S(13_i32);
- StorageDead(_11);
- StorageLive(_16);
- _16 = const {alloc1: &&BigStruct};
- _17 = deref_copy (*_16);
+ _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);
- _18 = deref_copy (*_16);
-- _12 = ((*_18).0: S);
-+ _12 = const S(1_i32);
+ _33 = deref_copy (*_14);
+ _12 = ((*_33).1: std::option::Option<S>);
StorageLive(_13);
- _19 = deref_copy (*_16);
-- _13 = ((*_19).1: u8);
-+ _13 = const 5_u8;
- StorageLive(_14);
- _20 = deref_copy (*_16);
-- _14 = ((*_20).2: f32);
-+ _14 = const 7f32;
+ _34 = deref_copy (*_14);
+ _13 = ((*_34).2: &[f32]);
+ StorageDead(_14);
StorageLive(_15);
- _21 = deref_copy (*_16);
-- _15 = ((*_21).3: S);
-+ _15 = const S(13_i32);
+ 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(_14);
StorageDead(_13);
StorageDead(_12);
- StorageDead(_10);
+ StorageDead(_11);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
@@ -117,13 +197,51 @@
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╼ │ ╾──────╼
+ }
+
+ ALLOC0 (size: 32, align: 8) {
+ 0x00 │ 01 00 00 00 23 00 00 00 ╾ALLOC1╼ │ ....#...╾──────╼
+ 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╼ │ ╾──────╼
}
- alloc1 (static: STAT, size: 8, align: 8) {
- ╾───────alloc15───────╼ │ ╾──────╼
+ ALLOC2 (size: 32, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾ALLOC3╼ │ ....░░░░╾──────╼
+ 0x10 │ 01 00 00 00 00 00 00 00 00 00 10 41 __ __ __ __ │ ...........A░░░░
}
- alloc15 (size: 16, align: 4) {
- 01 00 00 00 00 00 e0 40 0d 00 00 00 05 __ __ __ │ .......@.....░░░
+ ALLOC3 (size: 4, align: 4) {
+ 00 00 50 41 │ ..PA
}
diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs
index e92a1676d..043981a29 100644
--- a/tests/mir-opt/dataflow-const-prop/struct.rs
+++ b/tests/mir-opt/dataflow-const-prop/struct.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_BIT_WIDTH
@@ -5,7 +6,10 @@
struct S(i32);
#[derive(Copy, Clone)]
-struct BigStruct(S, u8, f32, S);
+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() {
@@ -14,9 +18,21 @@ fn main() {
s.0 = 3;
let b = a + s.0;
- const VAL: BigStruct = BigStruct(S(1), 5, 7., S(13));
- let BigStruct(a, b, c, d) = VAL;
+ 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;
- static STAT: &BigStruct = &BigStruct(S(1), 5, 7., S(13));
- let BigStruct(a, b, c, d) = *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.rs b/tests/mir-opt/dataflow-const-prop/terminator.rs
index 114dbeca5..92a42f22c 100644
--- a/tests/mir-opt/dataflow-const-prop/terminator.rs
+++ b/tests/mir-opt/dataflow-const-prop/terminator.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DataflowConstProp
diff --git a/tests/mir-opt/dataflow-const-prop/transmute.rs b/tests/mir-opt/dataflow-const-prop/transmute.rs
index c25e33ab0..bb85e4586 100644
--- a/tests/mir-opt/dataflow-const-prop/transmute.rs
+++ b/tests/mir-opt/dataflow-const-prop/transmute.rs
@@ -7,55 +7,77 @@ 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 {}
}
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
index fc0634b1f..fb28aa8f6 100644
--- 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
@@ -11,8 +11,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = Union32 { value: move _2 };
+- _2 = ();
+- _1 = Union32 { value: move _2 };
++ _2 = const ();
++ _1 = Union32 { value: const () };
StorageDead(_2);
_0 = move _1 as u32 (Transmute);
StorageDead(_1);
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
index fc0634b1f..fb28aa8f6 100644
--- 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
@@ -11,8 +11,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = Union32 { value: move _2 };
+- _2 = ();
+- _1 = Union32 { value: move _2 };
++ _2 = const ();
++ _1 = Union32 { value: const () };
StorageDead(_2);
_0 = move _1 as u32 (Transmute);
StorageDead(_1);
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
index d0c298ba2..5d17c47ae 100644
--- 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
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -14,6 +15,7 @@
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
index d0c298ba2..5d17c47ae 100644
--- 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
@@ -4,6 +4,7 @@
fn unreachable_box() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -14,6 +15,7 @@
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
index acbb5cd1b..c8d4d6edb 100644
--- 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
@@ -14,8 +14,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = move _2 as Never (Transmute);
+- _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
index acbb5cd1b..c8d4d6edb 100644
--- 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
@@ -14,8 +14,10 @@
bb0: {
StorageLive(_1);
StorageLive(_2);
- _2 = ();
- _1 = move _2 as Never (Transmute);
+- _2 = ();
+- _1 = move _2 as Never (Transmute);
++ _2 = const ();
++ _1 = const ZeroSized: Never;
unreachable;
}
}
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 5e385d21e..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: ();
- 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;
- scope 1 {
- debug a => _1;
- let _2: i32;
- scope 2 {
- debug b => _2;
- let _6: i32;
- scope 3 {
- debug c => _6;
- }
- }
- }
-
- bb0: {
- StorageLive(_1);
- _1 = (const 1_i32, const 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);
- 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);
- _0 = const ();
- StorageDead(_6);
- StorageDead(_2);
- StorageDead(_1);
- return;
- }
- }
-
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.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
index f09cdee14..dcd15fb2b 100644
--- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
+++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DeadStoreElimination
// compile-flags: -Zmir-enable-passes=+CopyProp
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
new file mode 100644
index 000000000..cf73358dc
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff
@@ -0,0 +1,29 @@
+- // MIR for `cycle` before DeadStoreElimination
++ // MIR for `cycle` after DeadStoreElimination
+
+ fn cycle(_1: i32, _2: i32, _3: i32) -> () {
+ let mut _0: ();
+ let mut _4: bool;
+- let mut _5: i32;
+
+ bb0: {
+ _4 = cond() -> [return: bb1, unwind continue];
+ }
+
+ bb1: {
+ switchInt(_4) -> [1: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+- _5 = _3;
+- _3 = _2;
+- _2 = _1;
+- _1 = _5;
+ _4 = cond() -> [return: bb1, unwind continue];
+ }
+
+ bb3: {
+ return;
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
deleted file mode 100644
index 6221d4780..000000000
--- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-abort.diff
+++ /dev/null
@@ -1,73 +0,0 @@
-- // MIR for `cycle` before DeadStoreElimination
-+ // MIR for `cycle` after DeadStoreElimination
-
- fn cycle(_1: i32, _2: i32, _3: i32) -> () {
- debug x => _1;
- debug y => _2;
- debug z => _3;
- let mut _0: ();
-- let mut _4: ();
-- let mut _5: bool;
-- let _6: i32;
-- let mut _7: i32;
-- let mut _8: i32;
-- let mut _9: i32;
-- let mut _10: !;
-- let _11: ();
-- let mut _12: !;
-+ let mut _4: bool;
-+ let _5: i32;
- scope 1 {
-- debug temp => _6;
-+ debug temp => _5;
- }
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
-- StorageLive(_5);
-- _5 = cond() -> [return: bb2, unwind unreachable];
-+ StorageLive(_4);
-+ _4 = cond() -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
-- switchInt(move _5) -> [0: bb4, otherwise: bb3];
-+ switchInt(move _4) -> [0: bb4, otherwise: bb3];
- }
-
- bb3: {
-- StorageLive(_6);
-- _6 = _3;
-- StorageLive(_7);
-- _7 = _2;
-- _3 = move _7;
-- StorageDead(_7);
-- StorageLive(_8);
-- _8 = _1;
-- _2 = move _8;
-- StorageDead(_8);
-- StorageLive(_9);
-- _9 = _6;
-- _1 = move _9;
-- StorageDead(_9);
-- _4 = const ();
-- StorageDead(_6);
-+ StorageLive(_5);
- StorageDead(_5);
-+ StorageDead(_4);
- goto -> bb1;
- }
-
- bb4: {
-- StorageLive(_11);
- _0 = const ();
-- StorageDead(_11);
-- StorageDead(_5);
-+ StorageDead(_4);
- return;
- }
- }
-
diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
deleted file mode 100644
index 4b922e05e..000000000
--- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff
+++ /dev/null
@@ -1,73 +0,0 @@
-- // MIR for `cycle` before DeadStoreElimination
-+ // MIR for `cycle` after DeadStoreElimination
-
- fn cycle(_1: i32, _2: i32, _3: i32) -> () {
- debug x => _1;
- debug y => _2;
- debug z => _3;
- let mut _0: ();
-- let mut _4: ();
-- let mut _5: bool;
-- let _6: i32;
-- let mut _7: i32;
-- let mut _8: i32;
-- let mut _9: i32;
-- let mut _10: !;
-- let _11: ();
-- let mut _12: !;
-+ let mut _4: bool;
-+ let _5: i32;
- scope 1 {
-- debug temp => _6;
-+ debug temp => _5;
- }
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
-- StorageLive(_5);
-- _5 = cond() -> [return: bb2, unwind continue];
-+ StorageLive(_4);
-+ _4 = cond() -> [return: bb2, unwind continue];
- }
-
- bb2: {
-- switchInt(move _5) -> [0: bb4, otherwise: bb3];
-+ switchInt(move _4) -> [0: bb4, otherwise: bb3];
- }
-
- bb3: {
-- StorageLive(_6);
-- _6 = _3;
-- StorageLive(_7);
-- _7 = _2;
-- _3 = move _7;
-- StorageDead(_7);
-- StorageLive(_8);
-- _8 = _1;
-- _2 = move _8;
-- StorageDead(_8);
-- StorageLive(_9);
-- _9 = _6;
-- _1 = move _9;
-- StorageDead(_9);
-- _4 = const ();
-- StorageDead(_6);
-+ StorageLive(_5);
- StorageDead(_5);
-+ StorageDead(_4);
- goto -> bb1;
- }
-
- bb4: {
-- StorageLive(_11);
- _0 = const ();
-- StorageDead(_11);
-- StorageDead(_5);
-+ StorageDead(_4);
- return;
- }
- }
-
diff --git a/tests/mir-opt/dead-store-elimination/cycle.rs b/tests/mir-opt/dead-store-elimination/cycle.rs
index cd34fe96e..8896f5ff3 100644
--- a/tests/mir-opt/dead-store-elimination/cycle.rs
+++ b/tests/mir-opt/dead-store-elimination/cycle.rs
@@ -1,21 +1,41 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// 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)
+ }
+ bb1 = {
+ match condition { true => bb2, _ => ret }
+ }
+ bb2 = {
+ let temp = z;
+ z = y;
+ y = x;
+ x = temp;
+ Call(condition = cond(), bb1)
+ }
+ ret = {
+ Return()
+ }
+ )
}
fn main() {
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.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.rs b/tests/mir-opt/deduplicate_blocks.rs
index 0c38c7f21..d3b89102f 100644
--- a/tests/mir-opt/deduplicate_blocks.rs
+++ b/tests/mir-opt/deduplicate_blocks.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DeduplicateBlocks
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.panic-abort.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
index 1f3b3ad64..0fad716a2 100644
--- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
+++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff
@@ -35,6 +35,7 @@
bb1: {
StorageDead(_2);
+ PlaceMention(_1);
StorageLive(_4);
_4 = move _1;
goto -> bb2;
@@ -52,6 +53,7 @@
bb3: {
StorageDead(_8);
+ PlaceMention(_7);
_10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
}
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
index da4cc188c..ae5656f02 100644
--- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
+++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff
@@ -35,6 +35,7 @@
bb1: {
StorageDead(_2);
+ PlaceMention(_1);
StorageLive(_4);
_4 = move _1;
goto -> bb2;
@@ -52,6 +53,7 @@
bb3: {
StorageDead(_8);
+ PlaceMention(_7);
_10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5];
}
diff --git a/tests/mir-opt/derefer_complex_case.rs b/tests/mir-opt/derefer_complex_case.rs
index cc619879e..6097d8739 100644
--- a/tests/mir-opt/derefer_complex_case.rs
+++ b/tests/mir-opt/derefer_complex_case.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_complex_case.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/derefer_inline_test.rs b/tests/mir-opt/derefer_inline_test.rs
index 7ac330e51..713c051f4 100644
--- a/tests/mir-opt/derefer_inline_test.rs
+++ b/tests/mir-opt/derefer_inline_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_inline_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
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
index 895dcf579..f4c034517 100644
--- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
+++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff
@@ -12,6 +12,9 @@
+ 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;
@@ -48,11 +51,16 @@
_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);
-+ switchInt((*_12)) -> [0: bb3, otherwise: bb4];
++ PlaceMention((*_12));
++ _13 = deref_copy (*_4);
++ _14 = deref_copy (*_13);
++ _15 = deref_copy (*_14);
++ switchInt((*_15)) -> [0: bb3, otherwise: bb4];
}
bb3: {
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
index 19b26c901..e3c0c6b7d 100644
--- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
+++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff
@@ -12,6 +12,9 @@
+ 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;
@@ -48,11 +51,16 @@
_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);
-+ switchInt((*_12)) -> [0: bb3, otherwise: bb4];
++ PlaceMention((*_12));
++ _13 = deref_copy (*_4);
++ _14 = deref_copy (*_13);
++ _15 = deref_copy (*_14);
++ switchInt((*_15)) -> [0: bb3, otherwise: bb4];
}
bb3: {
diff --git a/tests/mir-opt/derefer_terminator_test.rs b/tests/mir-opt/derefer_terminator_test.rs
index 164aa733a..3780ff5df 100644
--- a/tests/mir-opt/derefer_terminator_test.rs
+++ b/tests/mir-opt/derefer_terminator_test.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Derefer
// EMIT_MIR derefer_terminator_test.main.Derefer.diff
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
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.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.rs b/tests/mir-opt/dest-prop/branch.rs
index 5007aafb6..d8c74a0aa 100644
--- a/tests/mir-opt/dest-prop/branch.rs
+++ b/tests/mir-opt/dest-prop/branch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that assignment in both branches of an `if` are eliminated.
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs
index 1f8d58892..435cf07ab 100644
--- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs
+++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs
@@ -1,3 +1,4 @@
+// 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)
diff --git a/tests/mir-opt/dest-prop/cycle.rs b/tests/mir-opt/dest-prop/cycle.rs
index 9bc0cb05a..77cff062c 100644
--- a/tests/mir-opt/dest-prop/cycle.rs
+++ b/tests/mir-opt/dest-prop/cycle.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
// unit-test: DestinationPropagation
diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs
index 2f95ba0e3..a6fd542d3 100644
--- a/tests/mir-opt/dest-prop/dead_stores_79191.rs
+++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: DestinationPropagation
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
index a3ec09010..eb160fc19 100644
--- 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
@@ -7,15 +7,16 @@ fn f(_1: usize) -> usize {
let mut _3: usize;
let mut _4: usize;
scope 1 {
- debug b => _1;
+ debug b => _3;
}
bb0: {
nop;
+ _3 = _1;
+ _1 = const 5_usize;
nop;
nop;
- nop;
- nop;
+ _1 = move _3;
nop;
nop;
nop;
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
index 185feb4b4..9147de2ec 100644
--- 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
@@ -7,15 +7,16 @@ fn f(_1: usize) -> usize {
let mut _3: usize;
let mut _4: usize;
scope 1 {
- debug b => _1;
+ debug b => _3;
}
bb0: {
nop;
+ _3 = _1;
+ _1 = const 5_usize;
nop;
nop;
- nop;
- nop;
+ _1 = move _3;
nop;
nop;
nop;
diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs
index e67653c57..c9895f35c 100644
--- a/tests/mir-opt/dest-prop/dead_stores_better.rs
+++ b/tests/mir-opt/dest-prop/dead_stores_better.rs
@@ -1,3 +1,4 @@
+// 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.rs b/tests/mir-opt/dest-prop/simple.rs
index 0bcb2924f..03d209626 100644
--- a/tests/mir-opt/dest-prop/simple.rs
+++ b/tests/mir-opt/dest-prop/simple.rs
@@ -1,3 +1,4 @@
+// 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
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
index 459a9c442..142e08f4d 100644
--- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
+++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff
@@ -4,27 +4,20 @@
fn main() -> () {
let mut _0: ();
let _1: main::Un;
- let mut _2: u32;
- let mut _3: u32;
scope 1 {
debug un => _1;
scope 2 {
}
- scope 3 (inlined std::mem::drop::<u32>) {
- debug _x => _3;
+ scope 4 (inlined std::mem::drop::<u32>) {
+ debug _x => const 1_u32;
}
}
+ scope 3 (inlined val) {
+ }
bb0: {
StorageLive(_1);
- StorageLive(_2);
- _2 = val() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- StorageDead(_2);
- StorageLive(_3);
- StorageDead(_3);
+ _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
index d2eef9058..142e08f4d 100644
--- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
+++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff
@@ -4,27 +4,20 @@
fn main() -> () {
let mut _0: ();
let _1: main::Un;
- let mut _2: u32;
- let mut _3: u32;
scope 1 {
debug un => _1;
scope 2 {
}
- scope 3 (inlined std::mem::drop::<u32>) {
- debug _x => _3;
+ scope 4 (inlined std::mem::drop::<u32>) {
+ debug _x => const 1_u32;
}
}
+ scope 3 (inlined val) {
+ }
bb0: {
StorageLive(_1);
- StorageLive(_2);
- _2 = val() -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageDead(_2);
- StorageLive(_3);
- StorageDead(_3);
+ _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 4bc6f28c6..6d3e6d7fa 100644
--- a/tests/mir-opt/dest-prop/union.rs
+++ b/tests/mir-opt/dest-prop/union.rs
@@ -1,3 +1,4 @@
+// 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
diff --git a/tests/mir-opt/dest-prop/unreachable.rs b/tests/mir-opt/dest-prop/unreachable.rs
index e950dbbf5..a47d2a0c8 100644
--- a/tests/mir-opt/dest-prop/unreachable.rs
+++ b/tests/mir-opt/dest-prop/unreachable.rs
@@ -1,3 +1,4 @@
+// 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.rs b/tests/mir-opt/dont_inline_type_id.rs
index d8a566360..788c2f55d 100644
--- a/tests/mir-opt/dont_inline_type_id.rs
+++ b/tests/mir-opt/dont_inline_type_id.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Inline
// compile-flags: --crate-type=lib -C panic=abort
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 98d9d24af..000000000
--- a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-- // MIR for `generic` before InstSimplify
-+ // MIR for `generic` after InstSimplify
-
- fn generic() -> () {
- 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/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.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.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_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.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 ec5f5c1f1..775a60f1c 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc15 (size: 8, align: 4) {
++ 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 9bf8637ec..c4b575799 100644
--- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc15 (size: 16, align: 8) {
++ 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.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.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
index 7dc6d21a9..f7d0d1fb5 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc14 (size: 8, align: 4) {
++ 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 0b000876a..15f1bd0df 100644
--- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
+++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff
@@ -66,7 +66,7 @@
}
+ }
+
-+ alloc14 (size: 16, align: 8) {
++ 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 88a51000c..000000000
--- a/tests/mir-opt/equal_true.opt.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt` before InstSimplify
-+ // MIR for `opt` after InstSimplify
-
- fn opt(_1: bool) -> i32 {
- debug x => _1;
- let mut _0: i32;
- 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_i32;
- goto -> bb3;
- }
-
- bb2: {
- StorageDead(_3);
- _0 = const 1_i32;
- goto -> bb3;
- }
-
- bb3: {
- StorageDead(_2);
- return;
- }
- }
-
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 fba616d04..b04e09e88 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
@@ -18,7 +18,7 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
}
bb0: {
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1];
}
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.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.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff
index a538756ba..298a60848 100644
--- 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
@@ -7,104 +7,104 @@
debug upper => _3;
let mut _0: std::result::Result<(), std::fmt::Error>;
let _4: bool;
- let mut _5: &std::fmt::Formatter<'_>;
- let mut _7: std::option::Option<usize>;
- let mut _8: &std::fmt::Formatter<'_>;
- let mut _9: isize;
- let mut _11: &mut std::fmt::Formatter<'_>;
- let mut _12: &T;
- let mut _13: core::num::flt2dec::Sign;
- let mut _14: u32;
- let mut _15: u32;
- let mut _16: usize;
- let mut _17: bool;
- let mut _18: &mut std::fmt::Formatter<'_>;
- let mut _19: &T;
- let mut _20: core::num::flt2dec::Sign;
- let mut _21: 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 _6: core::num::flt2dec::Sign;
+ let _5: core::num::flt2dec::Sign;
scope 2 {
- debug sign => _6;
+ debug sign => _5;
scope 3 {
- debug precision => _10;
- let _10: usize;
+ 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);
- _5 = &(*_1);
- _4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind unreachable];
+ switchInt(_4) -> [0: bb2, otherwise: bb1];
}
bb1: {
- StorageDead(_5);
- StorageLive(_6);
- switchInt(_4) -> [0: bb3, otherwise: bb2];
+- _5 = MinusPlus;
++ _5 = const MinusPlus;
+ goto -> bb3;
}
bb2: {
-- _6 = MinusPlus;
-+ _6 = const MinusPlus;
- goto -> bb4;
+- _5 = Minus;
++ _5 = const Minus;
+ goto -> bb3;
}
bb3: {
-- _6 = Minus;
-+ _6 = const Minus;
- goto -> bb4;
+ StorageLive(_6);
+ _6 = ((*_1).4: std::option::Option<usize>);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [1: bb4, otherwise: bb6];
}
bb4: {
- StorageLive(_7);
- StorageLive(_8);
- _8 = &(*_1);
- _7 = Formatter::<'_>::precision(move _8) -> [return: bb5, unwind unreachable];
+ _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(_8);
- _9 = discriminant(_7);
- switchInt(move _9) -> [1: bb6, otherwise: bb8];
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
}
bb6: {
- _10 = ((_7 as Some).0: usize);
- StorageLive(_13);
- _13 = _6;
- StorageLive(_14);
- StorageLive(_15);
- _15 = _10 as u32 (IntToInt);
- _14 = Add(move _15, const 1_u32);
- StorageDead(_15);
- _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> [return: bb7, unwind unreachable];
+ StorageLive(_18);
+ _18 = _5;
+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable];
}
bb7: {
- StorageDead(_14);
- StorageDead(_13);
- goto -> bb10;
+ StorageDead(_18);
+ goto -> bb8;
}
bb8: {
- StorageLive(_20);
- _20 = _6;
- _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> [return: bb9, unwind unreachable];
- }
-
- bb9: {
- StorageDead(_20);
- goto -> bb10;
- }
-
- bb10: {
- StorageDead(_6);
+ StorageDead(_5);
StorageDead(_4);
- StorageDead(_7);
+ 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
index 8a3dcfab4..037f4f7cf 100644
--- 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
@@ -7,104 +7,104 @@
debug upper => _3;
let mut _0: std::result::Result<(), std::fmt::Error>;
let _4: bool;
- let mut _5: &std::fmt::Formatter<'_>;
- let mut _7: std::option::Option<usize>;
- let mut _8: &std::fmt::Formatter<'_>;
- let mut _9: isize;
- let mut _11: &mut std::fmt::Formatter<'_>;
- let mut _12: &T;
- let mut _13: core::num::flt2dec::Sign;
- let mut _14: u32;
- let mut _15: u32;
- let mut _16: usize;
- let mut _17: bool;
- let mut _18: &mut std::fmt::Formatter<'_>;
- let mut _19: &T;
- let mut _20: core::num::flt2dec::Sign;
- let mut _21: 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 _6: core::num::flt2dec::Sign;
+ let _5: core::num::flt2dec::Sign;
scope 2 {
- debug sign => _6;
+ debug sign => _5;
scope 3 {
- debug precision => _10;
- let _10: usize;
+ 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);
- _5 = &(*_1);
- _4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind continue];
+ switchInt(_4) -> [0: bb2, otherwise: bb1];
}
bb1: {
- StorageDead(_5);
- StorageLive(_6);
- switchInt(_4) -> [0: bb3, otherwise: bb2];
+- _5 = MinusPlus;
++ _5 = const MinusPlus;
+ goto -> bb3;
}
bb2: {
-- _6 = MinusPlus;
-+ _6 = const MinusPlus;
- goto -> bb4;
+- _5 = Minus;
++ _5 = const Minus;
+ goto -> bb3;
}
bb3: {
-- _6 = Minus;
-+ _6 = const Minus;
- goto -> bb4;
+ StorageLive(_6);
+ _6 = ((*_1).4: std::option::Option<usize>);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [1: bb4, otherwise: bb6];
}
bb4: {
- StorageLive(_7);
- StorageLive(_8);
- _8 = &(*_1);
- _7 = Formatter::<'_>::precision(move _8) -> [return: bb5, unwind continue];
+ _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(_8);
- _9 = discriminant(_7);
- switchInt(move _9) -> [1: bb6, otherwise: bb8];
+ StorageDead(_12);
+ StorageDead(_11);
+ goto -> bb8;
}
bb6: {
- _10 = ((_7 as Some).0: usize);
- StorageLive(_13);
- _13 = _6;
- StorageLive(_14);
- StorageLive(_15);
- _15 = _10 as u32 (IntToInt);
- _14 = Add(move _15, const 1_u32);
- StorageDead(_15);
- _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> [return: bb7, unwind continue];
+ StorageLive(_18);
+ _18 = _5;
+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind continue];
}
bb7: {
- StorageDead(_14);
- StorageDead(_13);
- goto -> bb10;
+ StorageDead(_18);
+ goto -> bb8;
}
bb8: {
- StorageLive(_20);
- _20 = _6;
- _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> [return: bb9, unwind continue];
- }
-
- bb9: {
- StorageDead(_20);
- goto -> bb10;
- }
-
- bb10: {
- StorageDead(_6);
+ StorageDead(_5);
StorageDead(_4);
- StorageDead(_7);
+ StorageDead(_6);
return;
}
}
diff --git a/tests/mir-opt/funky_arms.rs b/tests/mir-opt/funky_arms.rs
index 79fd9457c..14aad0399 100644
--- a/tests/mir-opt/funky_arms.rs
+++ b/tests/mir-opt/funky_arms.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: --crate-type lib -Cdebug-assertions=no
diff --git a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir
deleted file mode 100644
index d8bea1420..000000000
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-abort.mir
+++ /dev/null
@@ -1,82 +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: ();
- 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/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir b/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.mir
deleted file mode 100644
index d8b27eda8..000000000
--- a/tests/mir-opt/generator_drop_cleanup.main-{closure#0}.generator_drop.0.panic-unwind.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: ();
- 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/generator_drop_cleanup.rs b/tests/mir-opt/generator_drop_cleanup.rs
deleted file mode 100644
index 7e0d7bb59..000000000
--- a/tests/mir-opt/generator_drop_cleanup.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#![feature(generators, generator_trait)]
-
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-
-// 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.panic-abort.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
deleted file mode 100644
index 4587282de..000000000
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-abort.mir
+++ /dev/null
@@ -1,83 +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: ();
- 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: {
- generator_drop;
- }
-}
diff --git a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir b/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
deleted file mode 100644
index 38026f65b..000000000
--- a/tests/mir-opt/generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.panic-unwind.mir
+++ /dev/null
@@ -1,118 +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: ();
- 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: {
- generator_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/generator_storage_dead_unwind.rs
deleted file mode 100644
index 664f7ef67..000000000
--- a/tests/mir-opt/generator_storage_dead_unwind.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-
-// Test that we generate StorageDead on unwind paths for generators.
-//
-// Basic block and local names can safely change, but the StorageDead statements
-// should not go away.
-
-#![feature(generators, generator_trait)]
-
-struct Foo(i32);
-
-impl Drop for Foo {
- fn drop(&mut self) {}
-}
-
-struct Bar(i32);
-
-fn take<T>(_x: T) {}
-
-// EMIT_MIR generator_storage_dead_unwind.main-{closure#0}.StateTransform.before.mir
-fn main() {
- let _gen = || {
- let a = Foo(5);
- let b = Bar(6);
- yield;
- take(a);
- take(b);
- };
-}
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 ac7549f93..000000000
--- a/tests/mir-opt/generator_tiny.main-{closure#0}.generator_resume.0.mir
+++ /dev/null
@@ -1,86 +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;
- let mut _0: std::ops::GeneratorState<(), ()>;
- 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 {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop);
- }
-
- bb0: {
- _11 = discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})));
- switchInt(move _11) -> [0: bb1, 3: bb5, otherwise: bb6];
- }
-
- bb1: {
- _10 = move _2;
- nop;
- (((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19:24})) as variant#3).0: HasDrop) = HasDrop;
- StorageLive(_4);
- goto -> bb2;
- }
-
- bb2: {
- StorageLive(_6);
- StorageLive(_7);
- _7 = ();
- _0 = GeneratorState::<(), ()>::Yielded(move _7);
- discriminant((*(_1.0: &mut {generator@$DIR/generator_tiny.rs:19:16: 19: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/generator_tiny.rs
deleted file mode 100644
index 7dad63a61..000000000
--- a/tests/mir-opt/generator_tiny.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-//! Tests that generators that cannot return or unwind don't have unnecessary
-//! panic branches.
-
-// compile-flags: -C panic=abort
-// no-prefer-dynamic
-
-#![feature(generators, generator_trait)]
-
-struct HasDrop;
-
-impl Drop for HasDrop {
- fn drop(&mut self) {}
-}
-
-fn callee() {}
-
-// EMIT_MIR generator_tiny.main-{closure#0}.generator_resume.0.mir
-fn main() {
- let _gen = |_x: u8| {
- let _d = HasDrop;
- loop {
- yield;
- callee();
- }
- };
-}
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
index 3f5173c18..d524ad242 100644
--- a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff
@@ -67,11 +67,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0_u64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0_u64);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb1, unwind unreachable];
}
@@ -80,11 +80,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0_u64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0_u64);
+ StorageDead(_7);
_5 = opaque::<u64>(move _6) -> [return: bb2, unwind unreachable];
}
@@ -93,11 +93,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0_u64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0_u64);
+ StorageDead(_10);
_8 = opaque::<u64>(move _9) -> [return: bb3, unwind unreachable];
}
@@ -106,11 +106,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Mul(move _13, const 1_u64);
-- StorageDead(_13);
+ _12 = Mul(_1, const 1_u64);
+ StorageDead(_13);
_11 = opaque::<u64>(move _12) -> [return: bb4, unwind unreachable];
}
@@ -119,17 +119,18 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
- _17 = Eq(const 0_u64, const 0_u64);
+ StorageLive(_16);
+ _16 = _1;
+- _17 = Eq(const 0_u64, const 0_u64);
- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind unreachable];
-+ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
++ _17 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind unreachable];
}
bb5: {
- _15 = Div(move _16, const 0_u64);
-- StorageDead(_16);
+ _15 = Div(_1, const 0_u64);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb6, unwind unreachable];
}
@@ -138,17 +139,18 @@
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 1_u64, const 0_u64);
+ StorageLive(_20);
+ _20 = _1;
+- _21 = Eq(const 1_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind unreachable];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
++ _21 = const false;
++ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind unreachable];
}
bb7: {
- _19 = Div(move _20, const 1_u64);
-- StorageDead(_20);
+ _19 = Div(_1, const 1_u64);
+ StorageDead(_20);
_18 = opaque::<u64>(move _19) -> [return: bb8, unwind unreachable];
}
@@ -157,8 +159,8 @@
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
+ 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);
@@ -167,8 +169,8 @@
bb9: {
- _23 = Div(const 0_u64, move _24);
-- StorageDead(_24);
+ _23 = Div(const 0_u64, _1);
+ StorageDead(_24);
_22 = opaque::<u64>(move _23) -> [return: bb10, unwind unreachable];
}
@@ -177,17 +179,18 @@
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
+ 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);
-- StorageDead(_28);
+ _27 = Div(const 1_u64, _1);
+ StorageDead(_28);
_26 = opaque::<u64>(move _27) -> [return: bb12, unwind unreachable];
}
@@ -196,17 +199,18 @@
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
+ StorageLive(_32);
+ _32 = _1;
- _33 = Eq(const 0_u64, const 0_u64);
- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind unreachable];
-+ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind unreachable];
++ _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);
-- StorageDead(_32);
+ _31 = Rem(_1, const 0_u64);
+ StorageDead(_32);
_30 = opaque::<u64>(move _31) -> [return: bb14, unwind unreachable];
}
@@ -215,17 +219,18 @@
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
+ StorageLive(_36);
+ _36 = _1;
- _37 = Eq(const 1_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind unreachable];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind unreachable];
++ _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);
-- StorageDead(_36);
+ _35 = Rem(_1, const 1_u64);
+ StorageDead(_36);
_34 = opaque::<u64>(move _35) -> [return: bb16, unwind unreachable];
}
@@ -234,17 +239,18 @@
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
+ 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);
-- StorageDead(_40);
+ _39 = Rem(const 0_u64, _1);
+ StorageDead(_40);
_38 = opaque::<u64>(move _39) -> [return: bb18, unwind unreachable];
}
@@ -253,17 +259,18 @@
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
+ 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);
-- StorageDead(_44);
+ _43 = Rem(const 1_u64, _1);
+ StorageDead(_44);
_42 = opaque::<u64>(move _43) -> [return: bb20, unwind unreachable];
}
@@ -272,11 +279,11 @@
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
+ StorageLive(_48);
+ _48 = _1;
- _47 = BitAnd(move _48, const 0_u64);
-- StorageDead(_48);
+ _47 = BitAnd(_1, const 0_u64);
+ StorageDead(_48);
_46 = opaque::<u64>(move _47) -> [return: bb21, unwind unreachable];
}
@@ -285,11 +292,11 @@
StorageDead(_46);
StorageLive(_49);
StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+ StorageLive(_51);
+ _51 = _1;
- _50 = BitOr(move _51, const 0_u64);
-- StorageDead(_51);
+ _50 = BitOr(_1, const 0_u64);
+ StorageDead(_51);
_49 = opaque::<u64>(move _50) -> [return: bb22, unwind unreachable];
}
@@ -298,11 +305,11 @@
StorageDead(_49);
StorageLive(_52);
StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
+ StorageLive(_54);
+ _54 = _1;
- _53 = BitXor(move _54, const 0_u64);
-- StorageDead(_54);
+ _53 = BitXor(_1, const 0_u64);
+ StorageDead(_54);
_52 = opaque::<u64>(move _53) -> [return: bb23, unwind unreachable];
}
@@ -311,11 +318,11 @@
StorageDead(_52);
StorageLive(_55);
StorageLive(_56);
-- StorageLive(_57);
-- _57 = _1;
+ StorageLive(_57);
+ _57 = _1;
- _56 = Shr(move _57, const 0_i32);
-- StorageDead(_57);
+ _56 = Shr(_1, const 0_i32);
+ StorageDead(_57);
_55 = opaque::<u64>(move _56) -> [return: bb24, unwind unreachable];
}
@@ -324,11 +331,11 @@
StorageDead(_55);
StorageLive(_58);
StorageLive(_59);
-- StorageLive(_60);
-- _60 = _1;
+ StorageLive(_60);
+ _60 = _1;
- _59 = Shl(move _60, const 0_i32);
-- StorageDead(_60);
+ _59 = Shl(_1, const 0_i32);
+ StorageDead(_60);
_58 = opaque::<u64>(move _59) -> [return: bb25, unwind unreachable];
}
diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
index 38da21d91..9d6935393 100644
--- a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff
@@ -67,11 +67,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0_u64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0_u64);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb1, unwind continue];
}
@@ -80,11 +80,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0_u64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0_u64);
+ StorageDead(_7);
_5 = opaque::<u64>(move _6) -> [return: bb2, unwind continue];
}
@@ -93,11 +93,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0_u64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0_u64);
+ StorageDead(_10);
_8 = opaque::<u64>(move _9) -> [return: bb3, unwind continue];
}
@@ -106,11 +106,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Mul(move _13, const 1_u64);
-- StorageDead(_13);
+ _12 = Mul(_1, const 1_u64);
+ StorageDead(_13);
_11 = opaque::<u64>(move _12) -> [return: bb4, unwind continue];
}
@@ -119,17 +119,18 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
- _17 = Eq(const 0_u64, const 0_u64);
+ StorageLive(_16);
+ _16 = _1;
+- _17 = Eq(const 0_u64, const 0_u64);
- assert(!move _17, "attempt to divide `{}` by zero", _16) -> [success: bb5, unwind continue];
-+ assert(!_17, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
++ _17 = const true;
++ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb5, unwind continue];
}
bb5: {
- _15 = Div(move _16, const 0_u64);
-- StorageDead(_16);
+ _15 = Div(_1, const 0_u64);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb6, unwind continue];
}
@@ -138,17 +139,18 @@
StorageDead(_14);
StorageLive(_18);
StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 1_u64, const 0_u64);
+ StorageLive(_20);
+ _20 = _1;
+- _21 = Eq(const 1_u64, const 0_u64);
- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb7, unwind continue];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
++ _21 = const false;
++ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb7, unwind continue];
}
bb7: {
- _19 = Div(move _20, const 1_u64);
-- StorageDead(_20);
+ _19 = Div(_1, const 1_u64);
+ StorageDead(_20);
_18 = opaque::<u64>(move _19) -> [return: bb8, unwind continue];
}
@@ -157,8 +159,8 @@
StorageDead(_18);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
+ 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);
@@ -167,8 +169,8 @@
bb9: {
- _23 = Div(const 0_u64, move _24);
-- StorageDead(_24);
+ _23 = Div(const 0_u64, _1);
+ StorageDead(_24);
_22 = opaque::<u64>(move _23) -> [return: bb10, unwind continue];
}
@@ -177,17 +179,18 @@
StorageDead(_22);
StorageLive(_26);
StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
+ 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);
-- StorageDead(_28);
+ _27 = Div(const 1_u64, _1);
+ StorageDead(_28);
_26 = opaque::<u64>(move _27) -> [return: bb12, unwind continue];
}
@@ -196,17 +199,18 @@
StorageDead(_26);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
+ StorageLive(_32);
+ _32 = _1;
- _33 = Eq(const 0_u64, const 0_u64);
- assert(!move _33, "attempt to calculate the remainder of `{}` with a divisor of zero", _32) -> [success: bb13, unwind continue];
-+ assert(!_17, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb13, unwind continue];
++ _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);
-- StorageDead(_32);
+ _31 = Rem(_1, const 0_u64);
+ StorageDead(_32);
_30 = opaque::<u64>(move _31) -> [return: bb14, unwind continue];
}
@@ -215,17 +219,18 @@
StorageDead(_30);
StorageLive(_34);
StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
+ StorageLive(_36);
+ _36 = _1;
- _37 = Eq(const 1_u64, const 0_u64);
- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb15, unwind continue];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb15, unwind continue];
++ _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);
-- StorageDead(_36);
+ _35 = Rem(_1, const 1_u64);
+ StorageDead(_36);
_34 = opaque::<u64>(move _35) -> [return: bb16, unwind continue];
}
@@ -234,17 +239,18 @@
StorageDead(_34);
StorageLive(_38);
StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
+ 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);
-- StorageDead(_40);
+ _39 = Rem(const 0_u64, _1);
+ StorageDead(_40);
_38 = opaque::<u64>(move _39) -> [return: bb18, unwind continue];
}
@@ -253,17 +259,18 @@
StorageDead(_38);
StorageLive(_42);
StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
+ 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);
-- StorageDead(_44);
+ _43 = Rem(const 1_u64, _1);
+ StorageDead(_44);
_42 = opaque::<u64>(move _43) -> [return: bb20, unwind continue];
}
@@ -272,11 +279,11 @@
StorageDead(_42);
StorageLive(_46);
StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
+ StorageLive(_48);
+ _48 = _1;
- _47 = BitAnd(move _48, const 0_u64);
-- StorageDead(_48);
+ _47 = BitAnd(_1, const 0_u64);
+ StorageDead(_48);
_46 = opaque::<u64>(move _47) -> [return: bb21, unwind continue];
}
@@ -285,11 +292,11 @@
StorageDead(_46);
StorageLive(_49);
StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+ StorageLive(_51);
+ _51 = _1;
- _50 = BitOr(move _51, const 0_u64);
-- StorageDead(_51);
+ _50 = BitOr(_1, const 0_u64);
+ StorageDead(_51);
_49 = opaque::<u64>(move _50) -> [return: bb22, unwind continue];
}
@@ -298,11 +305,11 @@
StorageDead(_49);
StorageLive(_52);
StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
+ StorageLive(_54);
+ _54 = _1;
- _53 = BitXor(move _54, const 0_u64);
-- StorageDead(_54);
+ _53 = BitXor(_1, const 0_u64);
+ StorageDead(_54);
_52 = opaque::<u64>(move _53) -> [return: bb23, unwind continue];
}
@@ -311,11 +318,11 @@
StorageDead(_52);
StorageLive(_55);
StorageLive(_56);
-- StorageLive(_57);
-- _57 = _1;
+ StorageLive(_57);
+ _57 = _1;
- _56 = Shr(move _57, const 0_i32);
-- StorageDead(_57);
+ _56 = Shr(_1, const 0_i32);
+ StorageDead(_57);
_55 = opaque::<u64>(move _56) -> [return: bb24, unwind continue];
}
@@ -324,11 +331,11 @@
StorageDead(_55);
StorageLive(_58);
StorageLive(_59);
-- StorageLive(_60);
-- _60 = _1;
+ StorageLive(_60);
+ _60 = _1;
- _59 = Shl(move _60, const 0_i32);
-- StorageDead(_60);
+ _59 = Shl(_1, const 0_i32);
+ StorageDead(_60);
_58 = opaque::<u64>(move _59) -> [return: bb25, unwind continue];
}
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
index 0c342799e..6633df3ae 100644
--- a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff
@@ -20,63 +20,12 @@
let mut _15: u64;
let mut _16: u64;
let mut _17: (u64, bool);
- let _18: ();
- let mut _19: u64;
- let mut _20: u64;
- let mut _21: bool;
- let _22: ();
- let mut _23: u64;
- let mut _24: u64;
- let mut _25: bool;
- let _26: ();
- let mut _27: u64;
- let mut _28: u64;
- let mut _29: bool;
- let _30: ();
- let mut _31: u64;
- let mut _32: u64;
- let mut _33: bool;
- let _34: ();
- let mut _35: u64;
- let mut _36: u64;
- let mut _37: bool;
- let _38: ();
- let mut _39: u64;
- let mut _40: u64;
- let mut _41: bool;
- let _42: ();
- let mut _43: u64;
- let mut _44: u64;
- let mut _45: bool;
- let _46: ();
- let mut _47: u64;
- let mut _48: u64;
- let mut _49: bool;
- let _50: ();
- let mut _51: u64;
- let mut _52: u64;
- let _53: ();
- let mut _54: u64;
- let mut _55: u64;
- let _56: ();
- let mut _57: u64;
- let mut _58: u64;
- let _59: ();
- let mut _60: u64;
- let mut _61: u64;
- let mut _62: u32;
- let mut _63: bool;
- let _64: ();
- let mut _65: u64;
- let mut _66: u64;
- let mut _67: u32;
- let mut _68: bool;
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ 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);
@@ -85,7 +34,7 @@
bb1: {
_3 = move (_5.0: u64);
-- StorageDead(_4);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable];
}
@@ -94,8 +43,8 @@
StorageDead(_2);
StorageLive(_6);
StorageLive(_7);
-- StorageLive(_8);
-- _8 = _1;
+ 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);
@@ -104,7 +53,7 @@
bb3: {
_7 = move (_9.0: u64);
-- StorageDead(_8);
+ StorageDead(_8);
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable];
}
@@ -113,8 +62,8 @@
StorageDead(_6);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
-- _12 = _1;
+ 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);
@@ -123,7 +72,7 @@
bb5: {
_11 = move (_13.0: u64);
-- StorageDead(_12);
+ StorageDead(_12);
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind unreachable];
}
@@ -132,8 +81,8 @@
StorageDead(_10);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ 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);
@@ -142,246 +91,13 @@
bb7: {
_15 = move (_17.0: u64);
-- StorageDead(_16);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind unreachable];
}
bb8: {
StorageDead(_15);
StorageDead(_14);
- StorageLive(_18);
- StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 0_u64, const 0_u64);
-- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind unreachable];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind unreachable];
- }
-
- bb9: {
-- _19 = Div(move _20, const 0_u64);
-- StorageDead(_20);
-+ _19 = Div(_1, const 0_u64);
- _18 = opaque::<u64>(move _19) -> [return: bb10, unwind unreachable];
- }
-
- bb10: {
- StorageDead(_19);
- StorageDead(_18);
- StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
- _25 = Eq(const 1_u64, const 0_u64);
-- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind unreachable];
-+ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind unreachable];
- }
-
- bb11: {
-- _23 = Div(move _24, const 1_u64);
-- StorageDead(_24);
-+ _23 = Div(_1, const 1_u64);
- _22 = opaque::<u64>(move _23) -> [return: bb12, unwind unreachable];
- }
-
- bb12: {
- StorageDead(_23);
- StorageDead(_22);
- StorageLive(_26);
- StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
-- _29 = Eq(_28, const 0_u64);
-- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
-+ _29 = Eq(_1, const 0_u64);
-+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind unreachable];
- }
-
- bb13: {
-- _27 = Div(const 0_u64, move _28);
-- StorageDead(_28);
-+ _27 = Div(const 0_u64, _1);
- _26 = opaque::<u64>(move _27) -> [return: bb14, unwind unreachable];
- }
-
- bb14: {
- StorageDead(_27);
- StorageDead(_26);
- StorageLive(_30);
- StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
-- _33 = Eq(_32, const 0_u64);
-- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
-+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind unreachable];
- }
-
- bb15: {
-- _31 = Div(const 1_u64, move _32);
-- StorageDead(_32);
-+ _31 = Div(const 1_u64, _1);
- _30 = opaque::<u64>(move _31) -> [return: bb16, unwind unreachable];
- }
-
- bb16: {
- StorageDead(_31);
- StorageDead(_30);
- StorageLive(_34);
- StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
-- _37 = Eq(const 0_u64, const 0_u64);
-- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind unreachable];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind unreachable];
- }
-
- bb17: {
-- _35 = Rem(move _36, const 0_u64);
-- StorageDead(_36);
-+ _35 = Rem(_1, const 0_u64);
- _34 = opaque::<u64>(move _35) -> [return: bb18, unwind unreachable];
- }
-
- bb18: {
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_38);
- StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
-- _41 = Eq(const 1_u64, const 0_u64);
-- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind unreachable];
-+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind unreachable];
- }
-
- bb19: {
-- _39 = Rem(move _40, const 1_u64);
-- StorageDead(_40);
-+ _39 = Rem(_1, const 1_u64);
- _38 = opaque::<u64>(move _39) -> [return: bb20, unwind unreachable];
- }
-
- bb20: {
- StorageDead(_39);
- StorageDead(_38);
- StorageLive(_42);
- StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
-- _45 = Eq(_44, const 0_u64);
-- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind unreachable];
- }
-
- bb21: {
-- _43 = Rem(const 0_u64, move _44);
-- StorageDead(_44);
-+ _43 = Rem(const 0_u64, _1);
- _42 = opaque::<u64>(move _43) -> [return: bb22, unwind unreachable];
- }
-
- bb22: {
- StorageDead(_43);
- StorageDead(_42);
- StorageLive(_46);
- StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
-- _49 = Eq(_48, const 0_u64);
-- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind unreachable];
- }
-
- bb23: {
-- _47 = Rem(const 1_u64, move _48);
-- StorageDead(_48);
-+ _47 = Rem(const 1_u64, _1);
- _46 = opaque::<u64>(move _47) -> [return: bb24, unwind unreachable];
- }
-
- bb24: {
- StorageDead(_47);
- StorageDead(_46);
- StorageLive(_50);
- StorageLive(_51);
-- StorageLive(_52);
-- _52 = _1;
-- _51 = BitAnd(move _52, const 0_u64);
-- StorageDead(_52);
-+ _51 = BitAnd(_1, const 0_u64);
- _50 = opaque::<u64>(move _51) -> [return: bb25, unwind unreachable];
- }
-
- bb25: {
- StorageDead(_51);
- StorageDead(_50);
- StorageLive(_53);
- StorageLive(_54);
-- StorageLive(_55);
-- _55 = _1;
-- _54 = BitOr(move _55, const 0_u64);
-- StorageDead(_55);
-+ _54 = BitOr(_1, const 0_u64);
- _53 = opaque::<u64>(move _54) -> [return: bb26, unwind unreachable];
- }
-
- bb26: {
- StorageDead(_54);
- StorageDead(_53);
- StorageLive(_56);
- StorageLive(_57);
-- StorageLive(_58);
-- _58 = _1;
-- _57 = BitXor(move _58, const 0_u64);
-- StorageDead(_58);
-+ _57 = BitXor(_1, const 0_u64);
- _56 = opaque::<u64>(move _57) -> [return: bb27, unwind unreachable];
- }
-
- bb27: {
- StorageDead(_57);
- StorageDead(_56);
- StorageLive(_59);
- StorageLive(_60);
-- StorageLive(_61);
-- _61 = _1;
- _62 = const 0_i32 as u32 (IntToInt);
-- _63 = Lt(move _62, const 64_u32);
-- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
-+ _63 = Lt(_62, const 64_u32);
-+ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind unreachable];
- }
-
- bb28: {
-- _60 = Shr(move _61, const 0_i32);
-- StorageDead(_61);
-+ _60 = Shr(_1, const 0_i32);
- _59 = opaque::<u64>(move _60) -> [return: bb29, unwind unreachable];
- }
-
- bb29: {
- StorageDead(_60);
- StorageDead(_59);
- StorageLive(_64);
- StorageLive(_65);
-- StorageLive(_66);
-- _66 = _1;
-- _67 = const 0_i32 as u32 (IntToInt);
-- _68 = Lt(move _67, const 64_u32);
-- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
-+ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind unreachable];
- }
-
- bb30: {
-- _65 = Shl(move _66, const 0_i32);
-- StorageDead(_66);
-+ _65 = Shl(_1, const 0_i32);
- _64 = opaque::<u64>(move _65) -> [return: bb31, unwind unreachable];
- }
-
- bb31: {
- StorageDead(_65);
- StorageDead(_64);
_0 = const ();
return;
}
diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
index 7813c29b9..d100a77fe 100644
--- a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff
@@ -20,63 +20,12 @@
let mut _15: u64;
let mut _16: u64;
let mut _17: (u64, bool);
- let _18: ();
- let mut _19: u64;
- let mut _20: u64;
- let mut _21: bool;
- let _22: ();
- let mut _23: u64;
- let mut _24: u64;
- let mut _25: bool;
- let _26: ();
- let mut _27: u64;
- let mut _28: u64;
- let mut _29: bool;
- let _30: ();
- let mut _31: u64;
- let mut _32: u64;
- let mut _33: bool;
- let _34: ();
- let mut _35: u64;
- let mut _36: u64;
- let mut _37: bool;
- let _38: ();
- let mut _39: u64;
- let mut _40: u64;
- let mut _41: bool;
- let _42: ();
- let mut _43: u64;
- let mut _44: u64;
- let mut _45: bool;
- let _46: ();
- let mut _47: u64;
- let mut _48: u64;
- let mut _49: bool;
- let _50: ();
- let mut _51: u64;
- let mut _52: u64;
- let _53: ();
- let mut _54: u64;
- let mut _55: u64;
- let _56: ();
- let mut _57: u64;
- let mut _58: u64;
- let _59: ();
- let mut _60: u64;
- let mut _61: u64;
- let mut _62: u32;
- let mut _63: bool;
- let _64: ();
- let mut _65: u64;
- let mut _66: u64;
- let mut _67: u32;
- let mut _68: bool;
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ 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);
@@ -85,7 +34,7 @@
bb1: {
_3 = move (_5.0: u64);
-- StorageDead(_4);
+ StorageDead(_4);
_2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue];
}
@@ -94,8 +43,8 @@
StorageDead(_2);
StorageLive(_6);
StorageLive(_7);
-- StorageLive(_8);
-- _8 = _1;
+ 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);
@@ -104,7 +53,7 @@
bb3: {
_7 = move (_9.0: u64);
-- StorageDead(_8);
+ StorageDead(_8);
_6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue];
}
@@ -113,8 +62,8 @@
StorageDead(_6);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
-- _12 = _1;
+ 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);
@@ -123,7 +72,7 @@
bb5: {
_11 = move (_13.0: u64);
-- StorageDead(_12);
+ StorageDead(_12);
_10 = opaque::<u64>(move _11) -> [return: bb6, unwind continue];
}
@@ -132,8 +81,8 @@
StorageDead(_10);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ 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);
@@ -142,246 +91,13 @@
bb7: {
_15 = move (_17.0: u64);
-- StorageDead(_16);
+ StorageDead(_16);
_14 = opaque::<u64>(move _15) -> [return: bb8, unwind continue];
}
bb8: {
StorageDead(_15);
StorageDead(_14);
- StorageLive(_18);
- StorageLive(_19);
-- StorageLive(_20);
-- _20 = _1;
- _21 = Eq(const 0_u64, const 0_u64);
-- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb9, unwind continue];
-+ assert(!_21, "attempt to divide `{}` by zero", _1) -> [success: bb9, unwind continue];
- }
-
- bb9: {
-- _19 = Div(move _20, const 0_u64);
-- StorageDead(_20);
-+ _19 = Div(_1, const 0_u64);
- _18 = opaque::<u64>(move _19) -> [return: bb10, unwind continue];
- }
-
- bb10: {
- StorageDead(_19);
- StorageDead(_18);
- StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _1;
- _25 = Eq(const 1_u64, const 0_u64);
-- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb11, unwind continue];
-+ assert(!_25, "attempt to divide `{}` by zero", _1) -> [success: bb11, unwind continue];
- }
-
- bb11: {
-- _23 = Div(move _24, const 1_u64);
-- StorageDead(_24);
-+ _23 = Div(_1, const 1_u64);
- _22 = opaque::<u64>(move _23) -> [return: bb12, unwind continue];
- }
-
- bb12: {
- StorageDead(_23);
- StorageDead(_22);
- StorageLive(_26);
- StorageLive(_27);
-- StorageLive(_28);
-- _28 = _1;
-- _29 = Eq(_28, const 0_u64);
-- assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
-+ _29 = Eq(_1, const 0_u64);
-+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb13, unwind continue];
- }
-
- bb13: {
-- _27 = Div(const 0_u64, move _28);
-- StorageDead(_28);
-+ _27 = Div(const 0_u64, _1);
- _26 = opaque::<u64>(move _27) -> [return: bb14, unwind continue];
- }
-
- bb14: {
- StorageDead(_27);
- StorageDead(_26);
- StorageLive(_30);
- StorageLive(_31);
-- StorageLive(_32);
-- _32 = _1;
-- _33 = Eq(_32, const 0_u64);
-- assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
-+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb15, unwind continue];
- }
-
- bb15: {
-- _31 = Div(const 1_u64, move _32);
-- StorageDead(_32);
-+ _31 = Div(const 1_u64, _1);
- _30 = opaque::<u64>(move _31) -> [return: bb16, unwind continue];
- }
-
- bb16: {
- StorageDead(_31);
- StorageDead(_30);
- StorageLive(_34);
- StorageLive(_35);
-- StorageLive(_36);
-- _36 = _1;
-- _37 = Eq(const 0_u64, const 0_u64);
-- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb17, unwind continue];
-+ assert(!_21, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb17, unwind continue];
- }
-
- bb17: {
-- _35 = Rem(move _36, const 0_u64);
-- StorageDead(_36);
-+ _35 = Rem(_1, const 0_u64);
- _34 = opaque::<u64>(move _35) -> [return: bb18, unwind continue];
- }
-
- bb18: {
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_38);
- StorageLive(_39);
-- StorageLive(_40);
-- _40 = _1;
-- _41 = Eq(const 1_u64, const 0_u64);
-- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb19, unwind continue];
-+ assert(!_25, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb19, unwind continue];
- }
-
- bb19: {
-- _39 = Rem(move _40, const 1_u64);
-- StorageDead(_40);
-+ _39 = Rem(_1, const 1_u64);
- _38 = opaque::<u64>(move _39) -> [return: bb20, unwind continue];
- }
-
- bb20: {
- StorageDead(_39);
- StorageDead(_38);
- StorageLive(_42);
- StorageLive(_43);
-- StorageLive(_44);
-- _44 = _1;
-- _45 = Eq(_44, const 0_u64);
-- assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb21, unwind continue];
- }
-
- bb21: {
-- _43 = Rem(const 0_u64, move _44);
-- StorageDead(_44);
-+ _43 = Rem(const 0_u64, _1);
- _42 = opaque::<u64>(move _43) -> [return: bb22, unwind continue];
- }
-
- bb22: {
- StorageDead(_43);
- StorageDead(_42);
- StorageLive(_46);
- StorageLive(_47);
-- StorageLive(_48);
-- _48 = _1;
-- _49 = Eq(_48, const 0_u64);
-- assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
-+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb23, unwind continue];
- }
-
- bb23: {
-- _47 = Rem(const 1_u64, move _48);
-- StorageDead(_48);
-+ _47 = Rem(const 1_u64, _1);
- _46 = opaque::<u64>(move _47) -> [return: bb24, unwind continue];
- }
-
- bb24: {
- StorageDead(_47);
- StorageDead(_46);
- StorageLive(_50);
- StorageLive(_51);
-- StorageLive(_52);
-- _52 = _1;
-- _51 = BitAnd(move _52, const 0_u64);
-- StorageDead(_52);
-+ _51 = BitAnd(_1, const 0_u64);
- _50 = opaque::<u64>(move _51) -> [return: bb25, unwind continue];
- }
-
- bb25: {
- StorageDead(_51);
- StorageDead(_50);
- StorageLive(_53);
- StorageLive(_54);
-- StorageLive(_55);
-- _55 = _1;
-- _54 = BitOr(move _55, const 0_u64);
-- StorageDead(_55);
-+ _54 = BitOr(_1, const 0_u64);
- _53 = opaque::<u64>(move _54) -> [return: bb26, unwind continue];
- }
-
- bb26: {
- StorageDead(_54);
- StorageDead(_53);
- StorageLive(_56);
- StorageLive(_57);
-- StorageLive(_58);
-- _58 = _1;
-- _57 = BitXor(move _58, const 0_u64);
-- StorageDead(_58);
-+ _57 = BitXor(_1, const 0_u64);
- _56 = opaque::<u64>(move _57) -> [return: bb27, unwind continue];
- }
-
- bb27: {
- StorageDead(_57);
- StorageDead(_56);
- StorageLive(_59);
- StorageLive(_60);
-- StorageLive(_61);
-- _61 = _1;
- _62 = const 0_i32 as u32 (IntToInt);
-- _63 = Lt(move _62, const 64_u32);
-- assert(move _63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
-+ _63 = Lt(_62, const 64_u32);
-+ assert(_63, "attempt to shift right by `{}`, which would overflow", const 0_i32) -> [success: bb28, unwind continue];
- }
-
- bb28: {
-- _60 = Shr(move _61, const 0_i32);
-- StorageDead(_61);
-+ _60 = Shr(_1, const 0_i32);
- _59 = opaque::<u64>(move _60) -> [return: bb29, unwind continue];
- }
-
- bb29: {
- StorageDead(_60);
- StorageDead(_59);
- StorageLive(_64);
- StorageLive(_65);
-- StorageLive(_66);
-- _66 = _1;
-- _67 = const 0_i32 as u32 (IntToInt);
-- _68 = Lt(move _67, const 64_u32);
-- assert(move _68, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
-+ assert(_63, "attempt to shift left by `{}`, which would overflow", const 0_i32) -> [success: bb30, unwind continue];
- }
-
- bb30: {
-- _65 = Shl(move _66, const 0_i32);
-- StorageDead(_66);
-+ _65 = Shl(_1, const 0_i32);
- _64 = opaque::<u64>(move _65) -> [return: bb31, unwind continue];
- }
-
- bb31: {
- StorageDead(_65);
- StorageDead(_64);
_0 = const ();
return;
}
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
index 7d5ac8353..b332100ea 100644
--- a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff
@@ -37,11 +37,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0f64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0f64);
+ StorageDead(_4);
_2 = opaque::<f64>(move _3) -> [return: bb1, unwind unreachable];
}
@@ -50,11 +50,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0f64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0f64);
+ StorageDead(_7);
_5 = opaque::<f64>(move _6) -> [return: bb2, unwind unreachable];
}
@@ -63,11 +63,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0f64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0f64);
+ StorageDead(_10);
_8 = opaque::<f64>(move _9) -> [return: bb3, unwind unreachable];
}
@@ -76,11 +76,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Div(move _13, const 0f64);
-- StorageDead(_13);
+ _12 = Div(_1, const 0f64);
+ StorageDead(_13);
_11 = opaque::<f64>(move _12) -> [return: bb4, unwind unreachable];
}
@@ -89,11 +89,11 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ StorageLive(_16);
+ _16 = _1;
- _15 = Div(const 0f64, move _16);
-- StorageDead(_16);
+ _15 = Div(const 0f64, _1);
+ StorageDead(_16);
_14 = opaque::<f64>(move _15) -> [return: bb5, unwind unreachable];
}
@@ -102,11 +102,11 @@
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
-- StorageLive(_19);
-- _19 = _1;
+ StorageLive(_19);
+ _19 = _1;
- _18 = Rem(move _19, const 0f64);
-- StorageDead(_19);
+ _18 = Rem(_1, const 0f64);
+ StorageDead(_19);
_17 = opaque::<f64>(move _18) -> [return: bb6, unwind unreachable];
}
@@ -115,11 +115,11 @@
StorageDead(_17);
StorageLive(_20);
StorageLive(_21);
-- StorageLive(_22);
-- _22 = _1;
+ StorageLive(_22);
+ _22 = _1;
- _21 = Rem(const 0f64, move _22);
-- StorageDead(_22);
+ _21 = Rem(const 0f64, _1);
+ StorageDead(_22);
_20 = opaque::<f64>(move _21) -> [return: bb7, unwind unreachable];
}
@@ -128,14 +128,14 @@
StorageDead(_20);
StorageLive(_23);
StorageLive(_24);
-- StorageLive(_25);
-- _25 = _1;
-- StorageLive(_26);
-- _26 = _1;
+ StorageLive(_25);
+ _25 = _1;
+ StorageLive(_26);
+ _26 = _1;
- _24 = Eq(move _25, move _26);
-- StorageDead(_26);
-- StorageDead(_25);
+ _24 = Eq(_1, _1);
+ StorageDead(_26);
+ StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb8, unwind unreachable];
}
@@ -144,14 +144,14 @@
StorageDead(_23);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
-- _29 = _1;
-- StorageLive(_30);
-- _30 = _1;
+ StorageLive(_29);
+ _29 = _1;
+ StorageLive(_30);
+ _30 = _1;
- _28 = Ne(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
+ _28 = Ne(_1, _1);
+ StorageDead(_30);
+ StorageDead(_29);
_27 = opaque::<bool>(move _28) -> [return: bb9, unwind unreachable];
}
diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
index 36c26dc66..28664cb0a 100644
--- a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff
@@ -37,11 +37,11 @@
bb0: {
StorageLive(_2);
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = Add(move _4, const 0f64);
-- StorageDead(_4);
+ _3 = Add(_1, const 0f64);
+ StorageDead(_4);
_2 = opaque::<f64>(move _3) -> [return: bb1, unwind continue];
}
@@ -50,11 +50,11 @@
StorageDead(_2);
StorageLive(_5);
StorageLive(_6);
-- StorageLive(_7);
-- _7 = _1;
+ StorageLive(_7);
+ _7 = _1;
- _6 = Sub(move _7, const 0f64);
-- StorageDead(_7);
+ _6 = Sub(_1, const 0f64);
+ StorageDead(_7);
_5 = opaque::<f64>(move _6) -> [return: bb2, unwind continue];
}
@@ -63,11 +63,11 @@
StorageDead(_5);
StorageLive(_8);
StorageLive(_9);
-- StorageLive(_10);
-- _10 = _1;
+ StorageLive(_10);
+ _10 = _1;
- _9 = Mul(move _10, const 0f64);
-- StorageDead(_10);
+ _9 = Mul(_1, const 0f64);
+ StorageDead(_10);
_8 = opaque::<f64>(move _9) -> [return: bb3, unwind continue];
}
@@ -76,11 +76,11 @@
StorageDead(_8);
StorageLive(_11);
StorageLive(_12);
-- StorageLive(_13);
-- _13 = _1;
+ StorageLive(_13);
+ _13 = _1;
- _12 = Div(move _13, const 0f64);
-- StorageDead(_13);
+ _12 = Div(_1, const 0f64);
+ StorageDead(_13);
_11 = opaque::<f64>(move _12) -> [return: bb4, unwind continue];
}
@@ -89,11 +89,11 @@
StorageDead(_11);
StorageLive(_14);
StorageLive(_15);
-- StorageLive(_16);
-- _16 = _1;
+ StorageLive(_16);
+ _16 = _1;
- _15 = Div(const 0f64, move _16);
-- StorageDead(_16);
+ _15 = Div(const 0f64, _1);
+ StorageDead(_16);
_14 = opaque::<f64>(move _15) -> [return: bb5, unwind continue];
}
@@ -102,11 +102,11 @@
StorageDead(_14);
StorageLive(_17);
StorageLive(_18);
-- StorageLive(_19);
-- _19 = _1;
+ StorageLive(_19);
+ _19 = _1;
- _18 = Rem(move _19, const 0f64);
-- StorageDead(_19);
+ _18 = Rem(_1, const 0f64);
+ StorageDead(_19);
_17 = opaque::<f64>(move _18) -> [return: bb6, unwind continue];
}
@@ -115,11 +115,11 @@
StorageDead(_17);
StorageLive(_20);
StorageLive(_21);
-- StorageLive(_22);
-- _22 = _1;
+ StorageLive(_22);
+ _22 = _1;
- _21 = Rem(const 0f64, move _22);
-- StorageDead(_22);
+ _21 = Rem(const 0f64, _1);
+ StorageDead(_22);
_20 = opaque::<f64>(move _21) -> [return: bb7, unwind continue];
}
@@ -128,14 +128,14 @@
StorageDead(_20);
StorageLive(_23);
StorageLive(_24);
-- StorageLive(_25);
-- _25 = _1;
-- StorageLive(_26);
-- _26 = _1;
+ StorageLive(_25);
+ _25 = _1;
+ StorageLive(_26);
+ _26 = _1;
- _24 = Eq(move _25, move _26);
-- StorageDead(_26);
-- StorageDead(_25);
+ _24 = Eq(_1, _1);
+ StorageDead(_26);
+ StorageDead(_25);
_23 = opaque::<bool>(move _24) -> [return: bb8, unwind continue];
}
@@ -144,14 +144,14 @@
StorageDead(_23);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
-- _29 = _1;
-- StorageLive(_30);
-- _30 = _1;
+ StorageLive(_29);
+ _29 = _1;
+ StorageLive(_30);
+ _30 = _1;
- _28 = Ne(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
+ _28 = Ne(_1, _1);
+ StorageDead(_30);
+ StorageDead(_29);
_27 = opaque::<bool>(move _28) -> [return: bb9, unwind continue];
}
diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
index 513fe60b6..d43198c99 100644
--- a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff
@@ -105,19 +105,24 @@
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);
+ StorageLive(_6);
- _6 = _1;
- _5 = move _6 as u8 (IntToInt);
-- StorageDead(_6);
-+ _5 = const 1_i64 as u8 (IntToInt);
- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind unreachable];
++ _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: {
@@ -125,12 +130,14 @@
StorageDead(_4);
StorageLive(_7);
StorageLive(_8);
-- StorageLive(_9);
+ StorageLive(_9);
- _9 = _1;
- _8 = move _9 as u16 (IntToInt);
-- StorageDead(_9);
-+ _8 = const 1_i64 as u16 (IntToInt);
- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind unreachable];
++ _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: {
@@ -138,12 +145,14 @@
StorageDead(_7);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
+ StorageLive(_12);
- _12 = _1;
- _11 = move _12 as u32 (IntToInt);
-- StorageDead(_12);
-+ _11 = const 1_i64 as u32 (IntToInt);
- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind unreachable];
++ _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: {
@@ -151,12 +160,14 @@
StorageDead(_10);
StorageLive(_13);
StorageLive(_14);
-- StorageLive(_15);
+ StorageLive(_15);
- _15 = _1;
- _14 = move _15 as u64 (IntToInt);
-- StorageDead(_15);
-+ _14 = const 1_i64 as u64 (IntToInt);
- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind unreachable];
++ _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: {
@@ -164,12 +175,14 @@
StorageDead(_13);
StorageLive(_16);
StorageLive(_17);
-- StorageLive(_18);
+ StorageLive(_18);
- _18 = _1;
- _17 = move _18 as i8 (IntToInt);
-- StorageDead(_18);
-+ _17 = const 1_i64 as i8 (IntToInt);
- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind unreachable];
++ _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: {
@@ -177,12 +190,14 @@
StorageDead(_16);
StorageLive(_19);
StorageLive(_20);
-- StorageLive(_21);
+ StorageLive(_21);
- _21 = _1;
- _20 = move _21 as i16 (IntToInt);
-- StorageDead(_21);
-+ _20 = const 1_i64 as i16 (IntToInt);
- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind unreachable];
++ _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: {
@@ -190,35 +205,40 @@
StorageDead(_19);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
+ StorageLive(_24);
- _24 = _1;
- _23 = move _24 as i32 (IntToInt);
-- StorageDead(_24);
-+ _23 = const 1_i64 as i32 (IntToInt);
- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind unreachable];
++ _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);
+ 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(_26);
StorageDead(_25);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
+ StorageLive(_29);
- _29 = _1;
- _28 = move _29 as f32 (IntToFloat);
-- StorageDead(_29);
-+ _28 = const 1_i64 as f32 (IntToFloat);
- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind unreachable];
++ _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: {
@@ -226,12 +246,14 @@
StorageDead(_27);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
+ StorageLive(_32);
- _32 = _1;
- _31 = move _32 as f64 (IntToFloat);
-- StorageDead(_32);
-+ _31 = const 1_i64 as f64 (IntToFloat);
- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind unreachable];
++ _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: {
@@ -239,12 +261,14 @@
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
-- StorageLive(_35);
+ StorageLive(_35);
- _35 = _2;
- _34 = move _35 as u8 (IntToInt);
-- StorageDead(_35);
-+ _34 = const 1_u64 as u8 (IntToInt);
- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind unreachable];
++ _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: {
@@ -252,12 +276,14 @@
StorageDead(_33);
StorageLive(_36);
StorageLive(_37);
-- StorageLive(_38);
+ StorageLive(_38);
- _38 = _2;
- _37 = move _38 as u16 (IntToInt);
-- StorageDead(_38);
-+ _37 = const 1_u64 as u16 (IntToInt);
- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind unreachable];
++ _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: {
@@ -265,35 +291,40 @@
StorageDead(_36);
StorageLive(_39);
StorageLive(_40);
-- StorageLive(_41);
+ StorageLive(_41);
- _41 = _2;
- _40 = move _41 as u32 (IntToInt);
-- StorageDead(_41);
-+ _40 = const 1_u64 as u32 (IntToInt);
- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind unreachable];
++ _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);
+ 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(_43);
StorageDead(_42);
StorageLive(_44);
StorageLive(_45);
-- StorageLive(_46);
+ StorageLive(_46);
- _46 = _2;
- _45 = move _46 as i8 (IntToInt);
-- StorageDead(_46);
-+ _45 = const 1_u64 as i8 (IntToInt);
- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind unreachable];
++ _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: {
@@ -301,12 +332,14 @@
StorageDead(_44);
StorageLive(_47);
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = _2;
- _48 = move _49 as i16 (IntToInt);
-- StorageDead(_49);
-+ _48 = const 1_u64 as i16 (IntToInt);
- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind unreachable];
++ _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: {
@@ -314,12 +347,14 @@
StorageDead(_47);
StorageLive(_50);
StorageLive(_51);
-- StorageLive(_52);
+ StorageLive(_52);
- _52 = _2;
- _51 = move _52 as i32 (IntToInt);
-- StorageDead(_52);
-+ _51 = const 1_u64 as i32 (IntToInt);
- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind unreachable];
++ _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: {
@@ -327,12 +362,14 @@
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
-- StorageLive(_55);
+ StorageLive(_55);
- _55 = _2;
- _54 = move _55 as i64 (IntToInt);
-- StorageDead(_55);
-+ _54 = const 1_u64 as i64 (IntToInt);
- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind unreachable];
++ _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: {
@@ -340,12 +377,14 @@
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
-- StorageLive(_58);
+ StorageLive(_58);
- _58 = _2;
- _57 = move _58 as f32 (IntToFloat);
-- StorageDead(_58);
-+ _57 = const 1_u64 as f32 (IntToFloat);
- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind unreachable];
++ _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: {
@@ -353,12 +392,14 @@
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
+ StorageLive(_61);
- _61 = _2;
- _60 = move _61 as f64 (IntToFloat);
-- StorageDead(_61);
-+ _60 = const 1_u64 as f64 (IntToFloat);
- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind unreachable];
++ _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: {
@@ -366,12 +407,14 @@
StorageDead(_59);
StorageLive(_62);
StorageLive(_63);
-- StorageLive(_64);
+ StorageLive(_64);
- _64 = _3;
- _63 = move _64 as u8 (FloatToInt);
-- StorageDead(_64);
-+ _63 = const 1f64 as u8 (FloatToInt);
- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind unreachable];
++ _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: {
@@ -379,12 +422,14 @@
StorageDead(_62);
StorageLive(_65);
StorageLive(_66);
-- StorageLive(_67);
+ StorageLive(_67);
- _67 = _3;
- _66 = move _67 as u16 (FloatToInt);
-- StorageDead(_67);
-+ _66 = const 1f64 as u16 (FloatToInt);
- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind unreachable];
++ _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: {
@@ -392,12 +437,14 @@
StorageDead(_65);
StorageLive(_68);
StorageLive(_69);
-- StorageLive(_70);
+ StorageLive(_70);
- _70 = _3;
- _69 = move _70 as u32 (FloatToInt);
-- StorageDead(_70);
-+ _69 = const 1f64 as u32 (FloatToInt);
- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind unreachable];
++ _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: {
@@ -405,12 +452,14 @@
StorageDead(_68);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
+ StorageLive(_73);
- _73 = _3;
- _72 = move _73 as u64 (FloatToInt);
-- StorageDead(_73);
-+ _72 = const 1f64 as u64 (FloatToInt);
- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind unreachable];
++ _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: {
@@ -418,12 +467,14 @@
StorageDead(_71);
StorageLive(_74);
StorageLive(_75);
-- StorageLive(_76);
+ StorageLive(_76);
- _76 = _3;
- _75 = move _76 as i8 (FloatToInt);
-- StorageDead(_76);
-+ _75 = const 1f64 as i8 (FloatToInt);
- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind unreachable];
++ _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: {
@@ -431,12 +482,14 @@
StorageDead(_74);
StorageLive(_77);
StorageLive(_78);
-- StorageLive(_79);
+ StorageLive(_79);
- _79 = _3;
- _78 = move _79 as i16 (FloatToInt);
-- StorageDead(_79);
-+ _78 = const 1f64 as i16 (FloatToInt);
- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind unreachable];
++ _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: {
@@ -444,12 +497,14 @@
StorageDead(_77);
StorageLive(_80);
StorageLive(_81);
-- StorageLive(_82);
+ StorageLive(_82);
- _82 = _3;
- _81 = move _82 as i32 (FloatToInt);
-- StorageDead(_82);
-+ _81 = const 1f64 as i32 (FloatToInt);
- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind unreachable];
++ _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: {
@@ -457,12 +512,14 @@
StorageDead(_80);
StorageLive(_83);
StorageLive(_84);
-- StorageLive(_85);
+ StorageLive(_85);
- _85 = _3;
- _84 = move _85 as i64 (FloatToInt);
-- StorageDead(_85);
-+ _84 = const 1f64 as i64 (FloatToInt);
- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind unreachable];
++ _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: {
@@ -470,31 +527,37 @@
StorageDead(_83);
StorageLive(_86);
StorageLive(_87);
-- StorageLive(_88);
+ StorageLive(_88);
- _88 = _3;
- _87 = move _88 as f32 (FloatToFloat);
-- StorageDead(_88);
-+ _87 = const 1f64 as f32 (FloatToFloat);
- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind unreachable];
++ _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);
+ 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(_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
index 33192ed8d..08b97e13a 100644
--- a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff
@@ -105,19 +105,24 @@
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);
+ StorageLive(_6);
- _6 = _1;
- _5 = move _6 as u8 (IntToInt);
-- StorageDead(_6);
-+ _5 = const 1_i64 as u8 (IntToInt);
- _4 = opaque::<u8>(move _5) -> [return: bb1, unwind continue];
++ _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: {
@@ -125,12 +130,14 @@
StorageDead(_4);
StorageLive(_7);
StorageLive(_8);
-- StorageLive(_9);
+ StorageLive(_9);
- _9 = _1;
- _8 = move _9 as u16 (IntToInt);
-- StorageDead(_9);
-+ _8 = const 1_i64 as u16 (IntToInt);
- _7 = opaque::<u16>(move _8) -> [return: bb2, unwind continue];
++ _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: {
@@ -138,12 +145,14 @@
StorageDead(_7);
StorageLive(_10);
StorageLive(_11);
-- StorageLive(_12);
+ StorageLive(_12);
- _12 = _1;
- _11 = move _12 as u32 (IntToInt);
-- StorageDead(_12);
-+ _11 = const 1_i64 as u32 (IntToInt);
- _10 = opaque::<u32>(move _11) -> [return: bb3, unwind continue];
++ _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: {
@@ -151,12 +160,14 @@
StorageDead(_10);
StorageLive(_13);
StorageLive(_14);
-- StorageLive(_15);
+ StorageLive(_15);
- _15 = _1;
- _14 = move _15 as u64 (IntToInt);
-- StorageDead(_15);
-+ _14 = const 1_i64 as u64 (IntToInt);
- _13 = opaque::<u64>(move _14) -> [return: bb4, unwind continue];
++ _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: {
@@ -164,12 +175,14 @@
StorageDead(_13);
StorageLive(_16);
StorageLive(_17);
-- StorageLive(_18);
+ StorageLive(_18);
- _18 = _1;
- _17 = move _18 as i8 (IntToInt);
-- StorageDead(_18);
-+ _17 = const 1_i64 as i8 (IntToInt);
- _16 = opaque::<i8>(move _17) -> [return: bb5, unwind continue];
++ _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: {
@@ -177,12 +190,14 @@
StorageDead(_16);
StorageLive(_19);
StorageLive(_20);
-- StorageLive(_21);
+ StorageLive(_21);
- _21 = _1;
- _20 = move _21 as i16 (IntToInt);
-- StorageDead(_21);
-+ _20 = const 1_i64 as i16 (IntToInt);
- _19 = opaque::<i16>(move _20) -> [return: bb6, unwind continue];
++ _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: {
@@ -190,35 +205,40 @@
StorageDead(_19);
StorageLive(_22);
StorageLive(_23);
-- StorageLive(_24);
+ StorageLive(_24);
- _24 = _1;
- _23 = move _24 as i32 (IntToInt);
-- StorageDead(_24);
-+ _23 = const 1_i64 as i32 (IntToInt);
- _22 = opaque::<i32>(move _23) -> [return: bb7, unwind continue];
++ _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);
+ 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(_26);
StorageDead(_25);
StorageLive(_27);
StorageLive(_28);
-- StorageLive(_29);
+ StorageLive(_29);
- _29 = _1;
- _28 = move _29 as f32 (IntToFloat);
-- StorageDead(_29);
-+ _28 = const 1_i64 as f32 (IntToFloat);
- _27 = opaque::<f32>(move _28) -> [return: bb9, unwind continue];
++ _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: {
@@ -226,12 +246,14 @@
StorageDead(_27);
StorageLive(_30);
StorageLive(_31);
-- StorageLive(_32);
+ StorageLive(_32);
- _32 = _1;
- _31 = move _32 as f64 (IntToFloat);
-- StorageDead(_32);
-+ _31 = const 1_i64 as f64 (IntToFloat);
- _30 = opaque::<f64>(move _31) -> [return: bb10, unwind continue];
++ _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: {
@@ -239,12 +261,14 @@
StorageDead(_30);
StorageLive(_33);
StorageLive(_34);
-- StorageLive(_35);
+ StorageLive(_35);
- _35 = _2;
- _34 = move _35 as u8 (IntToInt);
-- StorageDead(_35);
-+ _34 = const 1_u64 as u8 (IntToInt);
- _33 = opaque::<u8>(move _34) -> [return: bb11, unwind continue];
++ _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: {
@@ -252,12 +276,14 @@
StorageDead(_33);
StorageLive(_36);
StorageLive(_37);
-- StorageLive(_38);
+ StorageLive(_38);
- _38 = _2;
- _37 = move _38 as u16 (IntToInt);
-- StorageDead(_38);
-+ _37 = const 1_u64 as u16 (IntToInt);
- _36 = opaque::<u16>(move _37) -> [return: bb12, unwind continue];
++ _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: {
@@ -265,35 +291,40 @@
StorageDead(_36);
StorageLive(_39);
StorageLive(_40);
-- StorageLive(_41);
+ StorageLive(_41);
- _41 = _2;
- _40 = move _41 as u32 (IntToInt);
-- StorageDead(_41);
-+ _40 = const 1_u64 as u32 (IntToInt);
- _39 = opaque::<u32>(move _40) -> [return: bb13, unwind continue];
++ _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);
+ 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(_43);
StorageDead(_42);
StorageLive(_44);
StorageLive(_45);
-- StorageLive(_46);
+ StorageLive(_46);
- _46 = _2;
- _45 = move _46 as i8 (IntToInt);
-- StorageDead(_46);
-+ _45 = const 1_u64 as i8 (IntToInt);
- _44 = opaque::<i8>(move _45) -> [return: bb15, unwind continue];
++ _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: {
@@ -301,12 +332,14 @@
StorageDead(_44);
StorageLive(_47);
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = _2;
- _48 = move _49 as i16 (IntToInt);
-- StorageDead(_49);
-+ _48 = const 1_u64 as i16 (IntToInt);
- _47 = opaque::<i16>(move _48) -> [return: bb16, unwind continue];
++ _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: {
@@ -314,12 +347,14 @@
StorageDead(_47);
StorageLive(_50);
StorageLive(_51);
-- StorageLive(_52);
+ StorageLive(_52);
- _52 = _2;
- _51 = move _52 as i32 (IntToInt);
-- StorageDead(_52);
-+ _51 = const 1_u64 as i32 (IntToInt);
- _50 = opaque::<i32>(move _51) -> [return: bb17, unwind continue];
++ _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: {
@@ -327,12 +362,14 @@
StorageDead(_50);
StorageLive(_53);
StorageLive(_54);
-- StorageLive(_55);
+ StorageLive(_55);
- _55 = _2;
- _54 = move _55 as i64 (IntToInt);
-- StorageDead(_55);
-+ _54 = const 1_u64 as i64 (IntToInt);
- _53 = opaque::<i64>(move _54) -> [return: bb18, unwind continue];
++ _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: {
@@ -340,12 +377,14 @@
StorageDead(_53);
StorageLive(_56);
StorageLive(_57);
-- StorageLive(_58);
+ StorageLive(_58);
- _58 = _2;
- _57 = move _58 as f32 (IntToFloat);
-- StorageDead(_58);
-+ _57 = const 1_u64 as f32 (IntToFloat);
- _56 = opaque::<f32>(move _57) -> [return: bb19, unwind continue];
++ _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: {
@@ -353,12 +392,14 @@
StorageDead(_56);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
+ StorageLive(_61);
- _61 = _2;
- _60 = move _61 as f64 (IntToFloat);
-- StorageDead(_61);
-+ _60 = const 1_u64 as f64 (IntToFloat);
- _59 = opaque::<f64>(move _60) -> [return: bb20, unwind continue];
++ _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: {
@@ -366,12 +407,14 @@
StorageDead(_59);
StorageLive(_62);
StorageLive(_63);
-- StorageLive(_64);
+ StorageLive(_64);
- _64 = _3;
- _63 = move _64 as u8 (FloatToInt);
-- StorageDead(_64);
-+ _63 = const 1f64 as u8 (FloatToInt);
- _62 = opaque::<u8>(move _63) -> [return: bb21, unwind continue];
++ _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: {
@@ -379,12 +422,14 @@
StorageDead(_62);
StorageLive(_65);
StorageLive(_66);
-- StorageLive(_67);
+ StorageLive(_67);
- _67 = _3;
- _66 = move _67 as u16 (FloatToInt);
-- StorageDead(_67);
-+ _66 = const 1f64 as u16 (FloatToInt);
- _65 = opaque::<u16>(move _66) -> [return: bb22, unwind continue];
++ _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: {
@@ -392,12 +437,14 @@
StorageDead(_65);
StorageLive(_68);
StorageLive(_69);
-- StorageLive(_70);
+ StorageLive(_70);
- _70 = _3;
- _69 = move _70 as u32 (FloatToInt);
-- StorageDead(_70);
-+ _69 = const 1f64 as u32 (FloatToInt);
- _68 = opaque::<u32>(move _69) -> [return: bb23, unwind continue];
++ _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: {
@@ -405,12 +452,14 @@
StorageDead(_68);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
+ StorageLive(_73);
- _73 = _3;
- _72 = move _73 as u64 (FloatToInt);
-- StorageDead(_73);
-+ _72 = const 1f64 as u64 (FloatToInt);
- _71 = opaque::<u64>(move _72) -> [return: bb24, unwind continue];
++ _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: {
@@ -418,12 +467,14 @@
StorageDead(_71);
StorageLive(_74);
StorageLive(_75);
-- StorageLive(_76);
+ StorageLive(_76);
- _76 = _3;
- _75 = move _76 as i8 (FloatToInt);
-- StorageDead(_76);
-+ _75 = const 1f64 as i8 (FloatToInt);
- _74 = opaque::<i8>(move _75) -> [return: bb25, unwind continue];
++ _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: {
@@ -431,12 +482,14 @@
StorageDead(_74);
StorageLive(_77);
StorageLive(_78);
-- StorageLive(_79);
+ StorageLive(_79);
- _79 = _3;
- _78 = move _79 as i16 (FloatToInt);
-- StorageDead(_79);
-+ _78 = const 1f64 as i16 (FloatToInt);
- _77 = opaque::<i16>(move _78) -> [return: bb26, unwind continue];
++ _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: {
@@ -444,12 +497,14 @@
StorageDead(_77);
StorageLive(_80);
StorageLive(_81);
-- StorageLive(_82);
+ StorageLive(_82);
- _82 = _3;
- _81 = move _82 as i32 (FloatToInt);
-- StorageDead(_82);
-+ _81 = const 1f64 as i32 (FloatToInt);
- _80 = opaque::<i32>(move _81) -> [return: bb27, unwind continue];
++ _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: {
@@ -457,12 +512,14 @@
StorageDead(_80);
StorageLive(_83);
StorageLive(_84);
-- StorageLive(_85);
+ StorageLive(_85);
- _85 = _3;
- _84 = move _85 as i64 (FloatToInt);
-- StorageDead(_85);
-+ _84 = const 1f64 as i64 (FloatToInt);
- _83 = opaque::<i64>(move _84) -> [return: bb28, unwind continue];
++ _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: {
@@ -470,31 +527,37 @@
StorageDead(_83);
StorageLive(_86);
StorageLive(_87);
-- StorageLive(_88);
+ StorageLive(_88);
- _88 = _3;
- _87 = move _88 as f32 (FloatToFloat);
-- StorageDead(_88);
-+ _87 = const 1f64 as f32 (FloatToFloat);
- _86 = opaque::<f32>(move _87) -> [return: bb29, unwind continue];
++ _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);
+ 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(_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.dereferences.GVN.panic-abort.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
index ee320cf67..a587b1e6b 100644
--- a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff
@@ -72,7 +72,8 @@
bb2: {
StorageDead(_7);
StorageDead(_6);
- StorageLive(_8);
+- StorageLive(_8);
++ nop;
_8 = &raw const (*_1);
StorageLive(_9);
StorageLive(_10);
@@ -92,7 +93,8 @@
bb4: {
StorageDead(_12);
StorageDead(_11);
- StorageLive(_13);
+- StorageLive(_13);
++ nop;
_13 = &raw mut (*_1);
StorageLive(_14);
StorageLive(_15);
@@ -112,10 +114,12 @@
bb6: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_18);
+- 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];
@@ -123,16 +127,18 @@
bb7: {
- StorageDead(_20);
++ nop;
StorageDead(_19);
StorageLive(_21);
-- StorageLive(_22);
+ 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(_22);
StorageDead(_21);
StorageLive(_23);
StorageLive(_24);
@@ -163,6 +169,7 @@
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];
@@ -170,21 +177,26 @@
bb12: {
- StorageDead(_30);
++ nop;
StorageDead(_29);
StorageLive(_31);
-- StorageLive(_32);
+ 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(_32);
StorageDead(_31);
_0 = const ();
- StorageDead(_18);
- StorageDead(_13);
- StorageDead(_8);
+- 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
index f627b4d59..6fdda5e99 100644
--- a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff
@@ -72,7 +72,8 @@
bb2: {
StorageDead(_7);
StorageDead(_6);
- StorageLive(_8);
+- StorageLive(_8);
++ nop;
_8 = &raw const (*_1);
StorageLive(_9);
StorageLive(_10);
@@ -92,7 +93,8 @@
bb4: {
StorageDead(_12);
StorageDead(_11);
- StorageLive(_13);
+- StorageLive(_13);
++ nop;
_13 = &raw mut (*_1);
StorageLive(_14);
StorageLive(_15);
@@ -112,10 +114,12 @@
bb6: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_18);
+- 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];
@@ -123,16 +127,18 @@
bb7: {
- StorageDead(_20);
++ nop;
StorageDead(_19);
StorageLive(_21);
-- StorageLive(_22);
+ 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(_22);
StorageDead(_21);
StorageLive(_23);
StorageLive(_24);
@@ -163,6 +169,7 @@
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];
@@ -170,21 +177,26 @@
bb12: {
- StorageDead(_30);
++ nop;
StorageDead(_29);
StorageLive(_31);
-- StorageLive(_32);
+ 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(_32);
StorageDead(_31);
_0 = const ();
- StorageDead(_18);
- StorageDead(_13);
- StorageDead(_8);
+- 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
index 0a6690028..29ca1ba59 100644
--- a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff
@@ -39,9 +39,9 @@
let mut _34: u8;
bb0: {
-- StorageLive(_4);
-- StorageLive(_5);
-- _5 = _1;
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
- switchInt(move _5) -> [0: bb4, otherwise: bb1];
+ switchInt(_1) -> [0: bb4, otherwise: bb1];
}
@@ -49,121 +49,130 @@
bb1: {
StorageLive(_6);
- StorageLive(_7);
-- StorageLive(_8);
-- _8 = _2;
-- StorageLive(_9);
-- _9 = _3;
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ StorageLive(_9);
+ _9 = _3;
- _7 = Add(move _8, move _9);
-- StorageDead(_9);
-- StorageDead(_8);
-- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable];
+ _7 = Add(_2, _3);
+ 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;
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+ StorageLive(_13);
+ _13 = _3;
- _11 = Add(move _12, move _13);
-- StorageDead(_13);
-- StorageDead(_12);
++ _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(_11);
StorageDead(_10);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb4: {
StorageLive(_14);
- StorageLive(_15);
-- StorageLive(_16);
-- _16 = _2;
-- StorageLive(_17);
-- _17 = _3;
++ nop;
+ StorageLive(_16);
+ _16 = _2;
+ StorageLive(_17);
+ _17 = _3;
- _15 = Add(move _16, move _17);
-- StorageDead(_17);
-- StorageDead(_16);
-- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable];
+ _15 = Add(_2, _3);
+ 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;
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _2;
+ StorageLive(_21);
+ _21 = _3;
- _19 = Add(move _20, move _21);
-- StorageDead(_21);
-- StorageDead(_20);
++ _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(_19);
StorageDead(_18);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb7: {
-- StorageDead(_5);
-- StorageDead(_4);
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _2;
-- StorageLive(_25);
-- _25 = _3;
++ nop;
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
- _23 = Add(move _24, move _25);
-- StorageDead(_25);
-- StorageDead(_24);
-- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable];
+ _23 = Add(_2, _3);
+ 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;
+ 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;
+ StorageLive(_28);
+ StorageLive(_29);
+ _29 = _2;
+ StorageLive(_30);
+ _30 = _3;
- _28 = Add(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
++ _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(_28);
StorageDead(_27);
_0 = const ();
goto -> bb13;
@@ -171,27 +180,28 @@
bb11: {
StorageLive(_31);
-- StorageLive(_32);
-- StorageLive(_33);
-- _33 = _2;
-- StorageLive(_34);
-- _34 = _3;
+ StorageLive(_32);
+ StorageLive(_33);
+ _33 = _2;
+ StorageLive(_34);
+ _34 = _3;
- _32 = Add(move _33, move _34);
-- StorageDead(_34);
-- StorageDead(_33);
++ _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(_32);
StorageDead(_31);
_0 = const ();
goto -> bb13;
}
bb13: {
-- StorageDead(_26);
+ 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
index 0199f2720..5394dc8be 100644
--- a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff
@@ -39,9 +39,9 @@
let mut _34: u8;
bb0: {
-- StorageLive(_4);
-- StorageLive(_5);
-- _5 = _1;
+ StorageLive(_4);
+ StorageLive(_5);
+ _5 = _1;
- switchInt(move _5) -> [0: bb4, otherwise: bb1];
+ switchInt(_1) -> [0: bb4, otherwise: bb1];
}
@@ -49,121 +49,130 @@
bb1: {
StorageLive(_6);
- StorageLive(_7);
-- StorageLive(_8);
-- _8 = _2;
-- StorageLive(_9);
-- _9 = _3;
++ nop;
+ StorageLive(_8);
+ _8 = _2;
+ StorageLive(_9);
+ _9 = _3;
- _7 = Add(move _8, move _9);
-- StorageDead(_9);
-- StorageDead(_8);
-- _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue];
+ _7 = Add(_2, _3);
+ 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;
+ StorageLive(_11);
+ StorageLive(_12);
+ _12 = _2;
+ StorageLive(_13);
+ _13 = _3;
- _11 = Add(move _12, move _13);
-- StorageDead(_13);
-- StorageDead(_12);
++ _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(_11);
StorageDead(_10);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb4: {
StorageLive(_14);
- StorageLive(_15);
-- StorageLive(_16);
-- _16 = _2;
-- StorageLive(_17);
-- _17 = _3;
++ nop;
+ StorageLive(_16);
+ _16 = _2;
+ StorageLive(_17);
+ _17 = _3;
- _15 = Add(move _16, move _17);
-- StorageDead(_17);
-- StorageDead(_16);
-- _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue];
+ _15 = Add(_2, _3);
+ 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;
+ StorageLive(_19);
+ StorageLive(_20);
+ _20 = _2;
+ StorageLive(_21);
+ _21 = _3;
- _19 = Add(move _20, move _21);
-- StorageDead(_21);
-- StorageDead(_20);
++ _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(_19);
StorageDead(_18);
-- _4 = const ();
+ _4 = const ();
goto -> bb7;
}
bb7: {
-- StorageDead(_5);
-- StorageDead(_4);
+ StorageDead(_5);
+ StorageDead(_4);
StorageLive(_22);
- StorageLive(_23);
-- StorageLive(_24);
-- _24 = _2;
-- StorageLive(_25);
-- _25 = _3;
++ nop;
+ StorageLive(_24);
+ _24 = _2;
+ StorageLive(_25);
+ _25 = _3;
- _23 = Add(move _24, move _25);
-- StorageDead(_25);
-- StorageDead(_24);
-- _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue];
+ _23 = Add(_2, _3);
+ 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;
+ 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;
+ StorageLive(_28);
+ StorageLive(_29);
+ _29 = _2;
+ StorageLive(_30);
+ _30 = _3;
- _28 = Add(move _29, move _30);
-- StorageDead(_30);
-- StorageDead(_29);
++ _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(_28);
StorageDead(_27);
_0 = const ();
goto -> bb13;
@@ -171,27 +180,28 @@
bb11: {
StorageLive(_31);
-- StorageLive(_32);
-- StorageLive(_33);
-- _33 = _2;
-- StorageLive(_34);
-- _34 = _3;
+ StorageLive(_32);
+ StorageLive(_33);
+ _33 = _2;
+ StorageLive(_34);
+ _34 = _3;
- _32 = Add(move _33, move _34);
-- StorageDead(_34);
-- StorageDead(_33);
++ _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(_32);
StorageDead(_31);
_0 = const ();
goto -> bb13;
}
bb13: {
-- StorageDead(_26);
+ 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
index b7ad4ab1f..7799c6114 100644
--- a/tests/mir-opt/gvn.references.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff
@@ -20,6 +20,24 @@
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);
@@ -94,11 +112,68 @@
bb8: {
StorageDead(_17);
StorageDead(_16);
- _0 = const ();
- drop(_1) -> [return: bb9, unwind unreachable];
+- 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
index 08ed4c629..880e7913f 100644
--- a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff
@@ -20,12 +20,30 @@
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: bb10];
+ _2 = opaque::<&impl Sized>(move _3) -> [return: bb1, unwind: bb14];
}
bb1: {
@@ -34,7 +52,7 @@
StorageLive(_4);
StorageLive(_5);
_5 = &_1;
- _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb10];
+ _4 = opaque::<&impl Sized>(move _5) -> [return: bb2, unwind: bb14];
}
bb2: {
@@ -43,7 +61,7 @@
StorageLive(_6);
StorageLive(_7);
_7 = &mut _1;
- _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb10];
+ _6 = opaque::<&mut impl Sized>(move _7) -> [return: bb3, unwind: bb14];
}
bb3: {
@@ -52,7 +70,7 @@
StorageLive(_8);
StorageLive(_9);
_9 = &mut _1;
- _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb10];
+ _8 = opaque::<&mut impl Sized>(move _9) -> [return: bb4, unwind: bb14];
}
bb4: {
@@ -61,7 +79,7 @@
StorageLive(_10);
StorageLive(_11);
_11 = &raw const _1;
- _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb10];
+ _10 = opaque::<*const impl Sized>(move _11) -> [return: bb5, unwind: bb14];
}
bb5: {
@@ -70,7 +88,7 @@
StorageLive(_12);
StorageLive(_13);
_13 = &raw const _1;
- _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb10];
+ _12 = opaque::<*const impl Sized>(move _13) -> [return: bb6, unwind: bb14];
}
bb6: {
@@ -79,7 +97,7 @@
StorageLive(_14);
StorageLive(_15);
_15 = &raw mut _1;
- _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb10];
+ _14 = opaque::<*mut impl Sized>(move _15) -> [return: bb7, unwind: bb14];
}
bb7: {
@@ -88,25 +106,82 @@
StorageLive(_16);
StorageLive(_17);
_17 = &raw mut _1;
- _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb10];
+ _16 = opaque::<*mut impl Sized>(move _17) -> [return: bb8, unwind: bb14];
}
bb8: {
StorageDead(_17);
StorageDead(_16);
- _0 = const ();
- drop(_1) -> [return: bb9, unwind: bb11];
+- 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;
}
- bb10 (cleanup): {
- drop(_1) -> [return: bb11, unwind terminate(cleanup)];
+ bb14 (cleanup): {
+ drop(_1) -> [return: bb15, unwind terminate(cleanup)];
}
- bb11 (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
index 4c29523d6..d937902e8 100644
--- a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff
@@ -23,11 +23,11 @@
bb0: {
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = [move _4; N];
-- StorageDead(_4);
+ _3 = [_1; N];
+ StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
@@ -40,8 +40,10 @@
}
bb1: {
- _6 = _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
+- _6 = _3[_7];
+- _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable];
++ _6 = _1;
++ _5 = opaque::<T>(_1) -> [return: bb2, unwind unreachable];
}
bb2: {
@@ -55,13 +57,16 @@
- _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 = _3[_12];
+- _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable];
++ _11 = _1;
++ _10 = opaque::<T>(_1) -> [return: bb4, unwind unreachable];
}
bb4: {
diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
index e44f54cf3..dd4d24b12 100644
--- a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff
@@ -23,11 +23,11 @@
bb0: {
StorageLive(_3);
-- StorageLive(_4);
-- _4 = _1;
+ StorageLive(_4);
+ _4 = _1;
- _3 = [move _4; N];
-- StorageDead(_4);
+ _3 = [_1; N];
+ StorageDead(_4);
StorageLive(_5);
StorageLive(_6);
StorageLive(_7);
@@ -40,8 +40,10 @@
}
bb1: {
- _6 = _3[_7];
- _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
+- _6 = _3[_7];
+- _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue];
++ _6 = _1;
++ _5 = opaque::<T>(_1) -> [return: bb2, unwind continue];
}
bb2: {
@@ -55,13 +57,16 @@
- _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 = _3[_12];
+- _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue];
++ _11 = _1;
++ _10 = opaque::<T>(_1) -> [return: bb4, unwind continue];
}
bb4: {
diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs
index a85e2ae36..10a66ced0 100644
--- a/tests/mir-opt/gvn.rs
+++ b/tests/mir-opt/gvn.rs
@@ -1,55 +1,133 @@
// 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.
- opaque((x + y) + z);
- opaque((x * y) + z);
- opaque((x - y) + z);
- opaque((x / y) + z);
- opaque((x % y) + z);
- opaque((x & y) + z);
- opaque((x | y) + z);
- opaque((x ^ y) + z);
- opaque((x << y) + z);
- opaque((x >> y) + z);
+ // 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);
@@ -57,13 +135,21 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
// 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!(),
@@ -71,163 +157,464 @@ fn wrap_unwrap<T: Copy>(x: T) -> T {
}
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);
- opaque(x / 0);
- opaque(x / 1);
- opaque(0 / x);
- opaque(1 / x);
- opaque(x % 0);
- opaque(x % 1);
- opaque(0 % x);
- opaque(1 % x);
- opaque(x & 0);
- opaque(x | 0);
- opaque(x ^ 0);
- opaque(x >> 0);
- opaque(x << 0);
}
+/// 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 {
- opaque(x + y); // a
- opaque(x + y); // should reuse a
+ // 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 {
- opaque(x + y); // b
- opaque(x + y); // shoud reuse b
+ // 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);
}
- opaque(x + y); // c
+ // 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 {
- opaque(x + y); // should reuse c
+ // CHECK: opaque::<u8>([[c]])
+ opaque(x + y);
} else {
- opaque(x + y); // should reuse c
+ // 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);
- opaque(&x); // should not reuse a
+ // 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);
- opaque(&mut x); // should not reuse a
+ // CHECK: [[ref5:_.*]] = &raw const _1;
+ // CHECK: opaque::<*const impl Sized>(move [[ref5]])
opaque(&raw const x);
- opaque(&raw const x); // should not reuse a
+ // 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);
- opaque(&raw mut x); // should not reuse a
+
+ 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); // this cannot reuse a, as x is &mut.
+ 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) }; // this cannot reuse a, as x is *const.
+ 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) }; // this cannot reuse a, as x is *mut.
+ 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); // this can reuse, as `z` is immutable ref, Freeze and Copy.
- opaque(&*z); // but not for a reborrow.
+ 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); // this cannot reuse, as `z` is not Freeze.
+ 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);
- opaque(s.0); // *s is not Copy, by (*s).0 is, so we can reuse.
}
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 { std::mem::transmute::<&str, &[u8]>(s) };
+ 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)
+ }
+ bb1 = {
+ // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str))
+ Call(c = identity(a.0), bb2)
+ }
+ bb2 = {
+ // CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute);
+ Call(cu = transmute::<_, u128>(c), bb3)
+ }
+ 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)
+ }
+ bb4 = {
+ // This returns a copy of `b`, which is not `a`.
+ // CHECK: [[d:_.*]] = identity::<&str>([[b]])
+ Call(d = identity(b), bb5)
+ }
+ bb5 = {
+ // CHECK: [[du:_.*]] = [[d]] as u128 (Transmute);
+ Call(du = transmute::<_, u128>(d), bb6)
+ }
+ 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()
+ })
+}
+
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();
@@ -235,15 +622,26 @@ fn main() {
references(5);
dereferences(&mut 5, &6, &S(7));
slices();
+ let (direct, indirect) = duplicate_slice();
+ assert_eq!(direct, indirect);
+ repeat();
+ fn_pointers();
+ indirect_static();
}
#[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
@@ -251,3 +649,7 @@ fn opaque(_: impl Sized) {}
// 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
diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
index de3d28d05..ec4499803 100644
--- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff
@@ -85,32 +85,35 @@
bb0: {
- StorageLive(_1);
++ nop;
_1 = const "my favourite slice";
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ 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(_3);
StorageDead(_2);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
-- StorageLive(_6);
+ 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(_6);
StorageDead(_5);
-- StorageLive(_7);
+ StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
+- StorageLive(_9);
++ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
@@ -120,28 +123,37 @@
bb3: {
StorageDead(_11);
_9 = &_10;
- StorageLive(_12);
+- StorageLive(_12);
++ nop;
StorageLive(_13);
StorageLive(_14);
- _14 = &(*_4);
+- _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 = (move _9, move _12);
+- StorageDead(_12);
+- StorageDead(_9);
++ _8 = (_9, _12);
++ nop;
++ nop;
StorageLive(_15);
- _15 = (_8.0: &*const u8);
+- _15 = (_8.0: &*const u8);
++ _15 = _9;
StorageLive(_16);
- _16 = (_8.1: &*const u8);
+- _16 = (_8.1: &*const u8);
++ _16 = _12;
StorageLive(_17);
StorageLive(_18);
- _18 = (*_15);
+- _18 = (*_15);
++ _18 = (*_9);
StorageLive(_19);
- _19 = (*_16);
+- _19 = (*_16);
++ _19 = (*_12);
_17 = Eq(move _18, move _19);
switchInt(move _17) -> [0: bb6, otherwise: bb5];
}
@@ -149,22 +161,23 @@
bb5: {
StorageDead(_19);
StorageDead(_18);
-- _7 = const ();
+ _7 = const ();
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
-- StorageDead(_7);
+ StorageDead(_7);
- StorageLive(_29);
++ nop;
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
StorageDead(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _29;
+ StorageLive(_32);
+ _32 = _29;
- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable];
+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind unreachable];
}
@@ -173,30 +186,38 @@
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
- _21 = core::panicking::AssertKind::Eq;
+- _21 = core::panicking::AssertKind::Eq;
++ nop;
++ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
-- StorageLive(_23);
+ StorageLive(_23);
- _23 = move _21;
++ _23 = const core::panicking::AssertKind::Eq;
StorageLive(_24);
- StorageLive(_25);
- _25 = &(*_15);
+- StorageLive(_25);
+- _25 = &(*_15);
++ nop;
++ _25 = &(*_9);
_24 = &(*_25);
StorageLive(_26);
- StorageLive(_27);
- _27 = &(*_16);
+- StorageLive(_27);
+- _27 = &(*_16);
++ nop;
++ _27 = &(*_12);
_26 = &(*_27);
StorageLive(_28);
_28 = Option::<Arguments<'_>>::None;
-- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind unreachable;
-+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind unreachable;
+- _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(_32);
StorageDead(_31);
-- StorageLive(_33);
+ StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
+- StorageLive(_35);
++ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
@@ -206,7 +227,8 @@
bb8: {
StorageDead(_37);
_35 = &_36;
- StorageLive(_38);
+- StorageLive(_38);
++ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
@@ -216,18 +238,25 @@
bb9: {
StorageDead(_40);
_38 = &_39;
- _34 = (move _35, move _38);
- StorageDead(_38);
- StorageDead(_35);
+- _34 = (move _35, move _38);
+- StorageDead(_38);
+- StorageDead(_35);
++ _34 = (_35, _38);
++ nop;
++ nop;
StorageLive(_41);
- _41 = (_34.0: &*const u8);
+- _41 = (_34.0: &*const u8);
++ _41 = _35;
StorageLive(_42);
- _42 = (_34.1: &*const u8);
+- _42 = (_34.1: &*const u8);
++ _42 = _38;
StorageLive(_43);
StorageLive(_44);
- _44 = (*_41);
+- _44 = (*_41);
++ _44 = (*_35);
StorageLive(_45);
- _45 = (*_42);
+- _45 = (*_42);
++ _45 = (*_38);
_43 = Eq(move _44, move _45);
switchInt(move _43) -> [0: bb11, otherwise: bb10];
}
@@ -235,18 +264,20 @@
bb10: {
StorageDead(_45);
StorageDead(_44);
-- _33 = const ();
+ _33 = const ();
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
-- StorageDead(_33);
+ StorageDead(_33);
_0 = const ();
- StorageDead(_29);
++ nop;
StorageDead(_4);
- StorageDead(_1);
++ nop;
return;
}
@@ -254,22 +285,29 @@
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
- _47 = core::panicking::AssertKind::Eq;
+- _47 = core::panicking::AssertKind::Eq;
++ nop;
++ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = move _47;
++ _49 = const core::panicking::AssertKind::Eq;
StorageLive(_50);
- StorageLive(_51);
- _51 = &(*_41);
+- StorageLive(_51);
+- _51 = &(*_41);
++ nop;
++ _51 = &(*_35);
_50 = &(*_51);
StorageLive(_52);
- StorageLive(_53);
- _53 = &(*_42);
+- StorageLive(_53);
+- _53 = &(*_42);
++ nop;
++ _53 = &(*_38);
_52 = &(*_53);
StorageLive(_54);
_54 = Option::<Arguments<'_>>::None;
-- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind unreachable;
-+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind unreachable;
+- _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
index f22bb2543..56a78ca86 100644
--- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff
@@ -85,32 +85,35 @@
bb0: {
- StorageLive(_1);
++ nop;
_1 = const "my favourite slice";
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ 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(_3);
StorageDead(_2);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
-- StorageLive(_6);
+ 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(_6);
StorageDead(_5);
-- StorageLive(_7);
+ StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
+- StorageLive(_9);
++ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
@@ -120,28 +123,37 @@
bb3: {
StorageDead(_11);
_9 = &_10;
- StorageLive(_12);
+- StorageLive(_12);
++ nop;
StorageLive(_13);
StorageLive(_14);
- _14 = &(*_4);
+- _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 = (move _9, move _12);
+- StorageDead(_12);
+- StorageDead(_9);
++ _8 = (_9, _12);
++ nop;
++ nop;
StorageLive(_15);
- _15 = (_8.0: &*const u8);
+- _15 = (_8.0: &*const u8);
++ _15 = _9;
StorageLive(_16);
- _16 = (_8.1: &*const u8);
+- _16 = (_8.1: &*const u8);
++ _16 = _12;
StorageLive(_17);
StorageLive(_18);
- _18 = (*_15);
+- _18 = (*_15);
++ _18 = (*_9);
StorageLive(_19);
- _19 = (*_16);
+- _19 = (*_16);
++ _19 = (*_12);
_17 = Eq(move _18, move _19);
switchInt(move _17) -> [0: bb6, otherwise: bb5];
}
@@ -149,22 +161,23 @@
bb5: {
StorageDead(_19);
StorageDead(_18);
-- _7 = const ();
+ _7 = const ();
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
-- StorageDead(_7);
+ StorageDead(_7);
- StorageLive(_29);
++ nop;
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
StorageDead(_30);
StorageLive(_31);
-- StorageLive(_32);
-- _32 = _29;
+ StorageLive(_32);
+ _32 = _29;
- _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue];
+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind continue];
}
@@ -173,30 +186,38 @@
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
- _21 = core::panicking::AssertKind::Eq;
+- _21 = core::panicking::AssertKind::Eq;
++ nop;
++ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
-- StorageLive(_23);
+ StorageLive(_23);
- _23 = move _21;
++ _23 = const core::panicking::AssertKind::Eq;
StorageLive(_24);
- StorageLive(_25);
- _25 = &(*_15);
+- StorageLive(_25);
+- _25 = &(*_15);
++ nop;
++ _25 = &(*_9);
_24 = &(*_25);
StorageLive(_26);
- StorageLive(_27);
- _27 = &(*_16);
+- StorageLive(_27);
+- _27 = &(*_16);
++ nop;
++ _27 = &(*_12);
_26 = &(*_27);
StorageLive(_28);
_28 = Option::<Arguments<'_>>::None;
-- _22 = core::panicking::assert_failed::<*const u8, *const u8>(move _23, move _24, move _26, move _28) -> unwind continue;
-+ _22 = core::panicking::assert_failed::<*const u8, *const u8>(_21, move _24, move _26, move _28) -> unwind continue;
+- _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(_32);
StorageDead(_31);
-- StorageLive(_33);
+ StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
+- StorageLive(_35);
++ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
@@ -206,7 +227,8 @@
bb8: {
StorageDead(_37);
_35 = &_36;
- StorageLive(_38);
+- StorageLive(_38);
++ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
@@ -216,18 +238,25 @@
bb9: {
StorageDead(_40);
_38 = &_39;
- _34 = (move _35, move _38);
- StorageDead(_38);
- StorageDead(_35);
+- _34 = (move _35, move _38);
+- StorageDead(_38);
+- StorageDead(_35);
++ _34 = (_35, _38);
++ nop;
++ nop;
StorageLive(_41);
- _41 = (_34.0: &*const u8);
+- _41 = (_34.0: &*const u8);
++ _41 = _35;
StorageLive(_42);
- _42 = (_34.1: &*const u8);
+- _42 = (_34.1: &*const u8);
++ _42 = _38;
StorageLive(_43);
StorageLive(_44);
- _44 = (*_41);
+- _44 = (*_41);
++ _44 = (*_35);
StorageLive(_45);
- _45 = (*_42);
+- _45 = (*_42);
++ _45 = (*_38);
_43 = Eq(move _44, move _45);
switchInt(move _43) -> [0: bb11, otherwise: bb10];
}
@@ -235,18 +264,20 @@
bb10: {
StorageDead(_45);
StorageDead(_44);
-- _33 = const ();
+ _33 = const ();
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
-- StorageDead(_33);
+ StorageDead(_33);
_0 = const ();
- StorageDead(_29);
++ nop;
StorageDead(_4);
- StorageDead(_1);
++ nop;
return;
}
@@ -254,22 +285,29 @@
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
- _47 = core::panicking::AssertKind::Eq;
+- _47 = core::panicking::AssertKind::Eq;
++ nop;
++ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
-- StorageLive(_49);
+ StorageLive(_49);
- _49 = move _47;
++ _49 = const core::panicking::AssertKind::Eq;
StorageLive(_50);
- StorageLive(_51);
- _51 = &(*_41);
+- StorageLive(_51);
+- _51 = &(*_41);
++ nop;
++ _51 = &(*_35);
_50 = &(*_51);
StorageLive(_52);
- StorageLive(_53);
- _53 = &(*_42);
+- StorageLive(_53);
+- _53 = &(*_42);
++ nop;
++ _53 = &(*_38);
_52 = &(*_53);
StorageLive(_54);
_54 = Option::<Arguments<'_>>::None;
-- _48 = core::panicking::assert_failed::<*const u8, *const u8>(move _49, move _50, move _52, move _54) -> unwind continue;
-+ _48 = core::panicking::assert_failed::<*const u8, *const u8>(_47, move _50, move _52, move _54) -> unwind continue;
+- _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
index bf866e2f4..0a747d3ae 100644
--- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff
@@ -65,11 +65,11 @@
let mut _60: u64;
let mut _61: u64;
let mut _62: u64;
- let mut _63: u64;
+ let _63: ();
let mut _64: u64;
- let _65: ();
+ let mut _65: u64;
let mut _66: u64;
- let mut _67: u64;
+ let _67: ();
let mut _68: u64;
let mut _69: u64;
let mut _70: u64;
@@ -77,25 +77,25 @@
let mut _72: u64;
let mut _73: u64;
let mut _74: u64;
- let mut _75: u64;
- let mut _76: u64;
- let _77: ();
+ let mut _75: bool;
+ let _76: ();
+ let mut _77: u64;
let mut _78: u64;
let mut _79: u64;
- let mut _80: u64;
- let mut _81: u64;
- let mut _82: bool;
+ let mut _80: bool;
+ let _81: ();
+ let mut _82: u64;
let mut _83: u64;
- let _84: ();
- let mut _85: u64;
+ let mut _84: u64;
+ let _85: ();
let mut _86: u64;
let mut _87: u64;
let mut _88: u64;
- let mut _89: bool;
+ let _89: ();
let mut _90: u64;
- let _91: ();
+ let mut _91: u64;
let mut _92: u64;
- let mut _93: u64;
+ let _93: ();
let mut _94: u64;
let mut _95: u64;
let mut _96: u64;
@@ -103,93 +103,91 @@
let mut _98: u64;
let mut _99: u64;
let mut _100: u64;
- let mut _101: u64;
- let mut _102: u64;
- let _103: ();
- let mut _104: u64;
- let mut _105: u64;
+ let _101: ();
+ let mut _102: u32;
+ let mut _103: u64;
+ let _104: ();
+ let mut _105: f32;
let mut _106: u64;
- let mut _107: u64;
- let mut _108: u64;
- let _109: ();
- let mut _110: u64;
+ let _107: ();
+ let mut _108: S<u64>;
+ let mut _109: u64;
+ let _110: ();
let mut _111: u64;
- let mut _112: u64;
+ let mut _112: S<u64>;
let mut _113: u64;
- let mut _114: u64;
- let _115: ();
+ let _114: ();
+ let mut _115: u64;
let mut _116: u64;
let mut _117: u64;
let mut _118: u64;
let mut _119: u64;
- let mut _120: u64;
- let _121: ();
- let mut _122: S<u64>;
+ let _120: ();
+ let mut _121: u64;
+ let mut _122: u64;
let mut _123: u64;
- let _124: ();
+ let mut _124: u64;
let mut _125: u64;
- let mut _126: S<u64>;
- let mut _127: u64;
- let _128: &u64;
- let _129: ();
+ let _126: &u64;
+ let _127: ();
+ let mut _128: u64;
+ let mut _129: u64;
let mut _130: u64;
- let mut _131: u64;
+ let _131: ();
let mut _132: u64;
- let _133: ();
+ let mut _133: u64;
let mut _134: u64;
- let mut _135: u64;
- let mut _136: u64;
- let _138: ();
+ let _136: ();
+ let mut _137: u64;
+ let mut _138: u64;
let mut _139: u64;
- let mut _140: u64;
+ let _140: ();
let mut _141: u64;
- let _142: ();
+ let mut _142: u64;
let mut _143: u64;
- let mut _144: u64;
- let mut _145: u64;
+ let _144: ();
let _146: ();
- let _148: ();
+ let mut _147: u64;
+ let mut _148: u64;
let mut _149: u64;
- let mut _150: u64;
+ let _150: ();
let mut _151: u64;
- let _152: ();
+ let mut _152: u64;
let mut _153: u64;
- let mut _154: u64;
- let mut _155: u64;
- let _157: ();
+ let _155: ();
+ let mut _156: u64;
+ let mut _157: u64;
let mut _158: u64;
- let mut _159: u64;
+ let _159: ();
let mut _160: u64;
- let _161: ();
+ let mut _161: u64;
let mut _162: u64;
- let mut _163: u64;
- let mut _164: u64;
- let _166: ();
+ let _164: ();
+ let mut _165: u64;
+ let mut _166: u64;
let mut _167: u64;
- let mut _168: u64;
+ let _168: ();
let mut _169: u64;
- let _170: ();
+ let mut _170: u64;
let mut _171: u64;
- let mut _172: u64;
- let mut _173: u64;
scope 1 {
- debug a => _128;
- let _137: &mut u64;
+ debug a => _126;
+ let _135: &mut u64;
scope 2 {
- debug b => _137;
- let _165: &u64;
+ debug b => _135;
+ let _163: &u64;
scope 3 {
- let _147: *const u64;
+ let _145: *const u64;
scope 4 {
- debug c => _147;
- let _156: *mut u64;
+ debug c => _145;
+ let _154: *mut u64;
scope 5 {
- debug d => _156;
+ debug d => _154;
}
}
}
scope 6 {
- debug e => _165;
+ debug e => _163;
}
}
}
@@ -197,61 +195,68 @@
bb0: {
StorageLive(_4);
- StorageLive(_5);
-- StorageLive(_6);
-- _6 = _1;
-- StorageLive(_7);
-- _7 = _2;
++ nop;
+ StorageLive(_6);
+ _6 = _1;
+ StorageLive(_7);
+ _7 = _2;
- _5 = Add(move _6, move _7);
-- StorageDead(_7);
-- StorageDead(_6);
-- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable];
+ _5 = Add(_1, _2);
+ 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);
-- StorageLive(_10);
-- _10 = _1;
-- StorageLive(_11);
-- _11 = _2;
++ nop;
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
- _9 = Mul(move _10, move _11);
-- StorageDead(_11);
-- StorageDead(_10);
-- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable];
+ _9 = Mul(_1, _2);
+ 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);
-- StorageLive(_14);
-- _14 = _1;
-- StorageLive(_15);
-- _15 = _2;
++ nop;
+ StorageLive(_14);
+ _14 = _1;
+ StorageLive(_15);
+ _15 = _2;
- _13 = Sub(move _14, move _15);
-- StorageDead(_15);
-- StorageDead(_14);
-- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable];
+ _13 = Sub(_1, _2);
+ 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);
-- StorageLive(_18);
-- _18 = _1;
-- StorageLive(_19);
-- _19 = _2;
++ 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);
@@ -260,623 +265,701 @@
bb4: {
- _17 = Div(move _18, move _19);
-- StorageDead(_19);
-- StorageDead(_18);
-- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable];
+ _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);
-- StorageLive(_23);
-- _23 = _1;
-- StorageLive(_24);
-- _24 = _2;
++ 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);
-- StorageDead(_24);
-- StorageDead(_23);
-- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable];
+ _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);
-- StorageLive(_28);
-- _28 = _1;
-- StorageLive(_29);
-- _29 = _2;
++ nop;
+ StorageLive(_28);
+ _28 = _1;
+ StorageLive(_29);
+ _29 = _2;
- _27 = BitAnd(move _28, move _29);
-- StorageDead(_29);
-- StorageDead(_28);
-- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable];
+ _27 = BitAnd(_1, _2);
+ 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);
-- StorageLive(_32);
-- _32 = _1;
-- StorageLive(_33);
-- _33 = _2;
++ nop;
+ StorageLive(_32);
+ _32 = _1;
+ StorageLive(_33);
+ _33 = _2;
- _31 = BitOr(move _32, move _33);
-- StorageDead(_33);
-- StorageDead(_32);
-- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable];
+ _31 = BitOr(_1, _2);
+ 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);
-- StorageLive(_36);
-- _36 = _1;
-- StorageLive(_37);
-- _37 = _2;
++ nop;
+ StorageLive(_36);
+ _36 = _1;
+ StorageLive(_37);
+ _37 = _2;
- _35 = BitXor(move _36, move _37);
-- StorageDead(_37);
-- StorageDead(_36);
-- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable];
+ _35 = BitXor(_1, _2);
+ 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);
-- StorageLive(_40);
-- _40 = _1;
-- StorageLive(_41);
-- _41 = _2;
++ nop;
+ StorageLive(_40);
+ _40 = _1;
+ StorageLive(_41);
+ _41 = _2;
- _39 = Shl(move _40, move _41);
-- StorageDead(_41);
-- StorageDead(_40);
-- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable];
+ _39 = Shl(_1, _2);
+ 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);
-- StorageLive(_44);
-- _44 = _1;
-- StorageLive(_45);
-- _45 = _2;
++ nop;
+ StorageLive(_44);
+ _44 = _1;
+ StorageLive(_45);
+ _45 = _2;
- _43 = Shr(move _44, move _45);
-- StorageDead(_45);
-- StorageDead(_44);
-- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable];
+ _43 = Shr(_1, _2);
+ 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);
-- StorageLive(_48);
-- _48 = _1;
+- StorageLive(_47);
++ nop;
+ StorageLive(_48);
+ _48 = _1;
- _47 = move _48 as u32 (IntToInt);
-- StorageDead(_48);
+ _47 = _1 as u32 (IntToInt);
- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
+ StorageDead(_48);
+- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable];
++ _46 = opaque::<u32>(_47) -> [return: bb13, unwind unreachable];
}
bb13: {
- StorageDead(_47);
+- StorageDead(_47);
++ nop;
StorageDead(_46);
StorageLive(_49);
- StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+- StorageLive(_50);
++ nop;
+ StorageLive(_51);
+ _51 = _1;
- _50 = move _51 as f32 (IntToFloat);
-- StorageDead(_51);
+ _50 = _1 as f32 (IntToFloat);
- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
+ StorageDead(_51);
+- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable];
++ _49 = opaque::<f32>(_50) -> [return: bb14, unwind unreachable];
}
bb14: {
- StorageDead(_50);
+- StorageDead(_50);
++ nop;
StorageDead(_49);
StorageLive(_52);
- StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
++ nop;
+ StorageLive(_54);
+ _54 = _1;
- _53 = S::<u64>(move _54);
-- StorageDead(_54);
-- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable];
+ _53 = S::<u64>(_1);
+ 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;
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = _1;
- _57 = S::<u64>(move _58);
-- StorageDead(_58);
++ _57 = _53;
+ StorageDead(_58);
- _56 = (_57.0: u64);
- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind unreachable];
-+ _56 = (_53.0: u64);
-+ _55 = opaque::<u64>(_56) -> [return: bb16, unwind unreachable];
++ _56 = _1;
++ _55 = opaque::<u64>(_1) -> [return: bb16, unwind unreachable];
}
bb16: {
-- StorageDead(_56);
-- StorageDead(_57);
+ StorageDead(_56);
+ StorageDead(_57);
StorageDead(_55);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
-- StorageLive(_62);
-- _62 = _1;
-- StorageLive(_63);
-- _63 = _2;
-- _61 = Add(move _62, move _63);
-- StorageDead(_63);
-- StorageDead(_62);
- StorageLive(_64);
- _64 = _3;
-- _60 = Add(move _61, move _64);
-+ _60 = Add(_5, move _64);
- StorageDead(_64);
-- StorageDead(_61);
- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable];
+ 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);
-- StorageLive(_67);
-- StorageLive(_68);
-- _68 = _1;
-- StorageLive(_69);
-- _69 = _2;
-- _67 = Mul(move _68, move _69);
-- StorageDead(_69);
-- StorageDead(_68);
+ _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 = _3;
-- _66 = Add(move _67, move _70);
-+ _66 = Add(_9, move _70);
+ _70 = _2;
+- _68 = Sub(move _69, move _70);
++ _68 = _13;
StorageDead(_70);
-- StorageDead(_67);
- _65 = opaque::<u64>(move _66) -> [return: bb18, unwind unreachable];
+ StorageDead(_69);
+- _67 = opaque::<u64>(move _68) -> [return: bb19, unwind unreachable];
++ _67 = opaque::<u64>(_13) -> [return: bb19, unwind unreachable];
}
- bb18: {
- StorageDead(_66);
- StorageDead(_65);
+ bb19: {
+ StorageDead(_68);
+ StorageDead(_67);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
-- StorageLive(_74);
-- _74 = _1;
-- StorageLive(_75);
-- _75 = _2;
-- _73 = Sub(move _74, move _75);
-- StorageDead(_75);
-- StorageDead(_74);
- StorageLive(_76);
- _76 = _3;
-- _72 = Add(move _73, move _76);
-+ _72 = Add(_13, move _76);
- StorageDead(_76);
-- StorageDead(_73);
- _71 = opaque::<u64>(move _72) -> [return: bb19, unwind unreachable];
+ 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];
}
- bb19: {
+ 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);
-- StorageLive(_79);
-- StorageLive(_80);
-- _80 = _1;
-- StorageLive(_81);
-- _81 = _2;
-- _82 = Eq(_81, const 0_u64);
-- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind unreachable];
-+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable];
+ _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];
}
- bb20: {
-- _79 = Div(move _80, move _81);
-- StorageDead(_81);
-- StorageDead(_80);
- StorageLive(_83);
- _83 = _3;
-- _78 = Add(move _79, move _83);
-+ _78 = Add(_17, move _83);
- StorageDead(_83);
-- StorageDead(_79);
- _77 = opaque::<u64>(move _78) -> [return: bb21, unwind unreachable];
+ 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];
}
- bb21: {
- StorageDead(_78);
+ bb23: {
StorageDead(_77);
+ StorageDead(_76);
+ StorageLive(_81);
+ StorageLive(_82);
+ StorageLive(_83);
+ _83 = _1;
StorageLive(_84);
- StorageLive(_85);
-- StorageLive(_86);
-- StorageLive(_87);
-- _87 = _1;
-- StorageLive(_88);
-- _88 = _2;
-- _89 = Eq(_88, const 0_u64);
-- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind unreachable];
-+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable];
+ _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];
}
- bb22: {
-- _86 = Rem(move _87, move _88);
-- StorageDead(_88);
-- StorageDead(_87);
- StorageLive(_90);
- _90 = _3;
-- _85 = Add(move _86, move _90);
-+ _85 = Add(_22, move _90);
- StorageDead(_90);
-- StorageDead(_86);
- _84 = opaque::<u64>(move _85) -> [return: bb23, unwind unreachable];
+ 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];
}
- bb23: {
+ bb25: {
+ StorageDead(_86);
StorageDead(_85);
- StorageDead(_84);
+ StorageLive(_89);
+ StorageLive(_90);
StorageLive(_91);
+ _91 = _1;
StorageLive(_92);
-- StorageLive(_93);
-- StorageLive(_94);
-- _94 = _1;
-- StorageLive(_95);
-- _95 = _2;
-- _93 = BitAnd(move _94, move _95);
-- StorageDead(_95);
-- StorageDead(_94);
+ _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 = _3;
-- _92 = Add(move _93, move _96);
-+ _92 = Add(_27, move _96);
+ _96 = _2;
+- _94 = Shl(move _95, move _96);
++ _94 = _39;
StorageDead(_96);
-- StorageDead(_93);
- _91 = opaque::<u64>(move _92) -> [return: bb24, unwind unreachable];
+ StorageDead(_95);
+- _93 = opaque::<u64>(move _94) -> [return: bb27, unwind unreachable];
++ _93 = opaque::<u64>(_39) -> [return: bb27, unwind unreachable];
}
- bb24: {
- StorageDead(_92);
- StorageDead(_91);
+ bb27: {
+ StorageDead(_94);
+ StorageDead(_93);
StorageLive(_97);
StorageLive(_98);
-- StorageLive(_99);
-- StorageLive(_100);
-- _100 = _1;
-- StorageLive(_101);
-- _101 = _2;
-- _99 = BitOr(move _100, move _101);
-- StorageDead(_101);
-- StorageDead(_100);
- StorageLive(_102);
- _102 = _3;
-- _98 = Add(move _99, move _102);
-+ _98 = Add(_31, move _102);
- StorageDead(_102);
-- StorageDead(_99);
- _97 = opaque::<u64>(move _98) -> [return: bb25, unwind unreachable];
+ 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];
}
- bb25: {
+ 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;
-- StorageLive(_107);
-- _107 = _2;
-- _105 = BitXor(move _106, move _107);
-- StorageDead(_107);
-- StorageDead(_106);
- StorageLive(_108);
- _108 = _3;
-- _104 = Add(move _105, move _108);
-+ _104 = Add(_35, move _108);
- StorageDead(_108);
-- StorageDead(_105);
- _103 = opaque::<u64>(move _104) -> [return: bb26, unwind unreachable];
+ 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];
}
- bb26: {
+ bb30: {
+ StorageDead(_105);
StorageDead(_104);
- StorageDead(_103);
+ 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);
-- _112 = _1;
-- StorageLive(_113);
-- _113 = _2;
-- _111 = Shl(move _112, move _113);
-- StorageDead(_113);
-- StorageDead(_112);
- StorageLive(_114);
- _114 = _3;
-- _110 = Add(move _111, move _114);
-+ _110 = Add(_39, move _114);
- StorageDead(_114);
-- StorageDead(_111);
- _109 = opaque::<u64>(move _110) -> [return: bb27, unwind unreachable];
+ 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];
}
- bb27: {
+ bb32: {
+ StorageDead(_111);
+ StorageDead(_112);
StorageDead(_110);
- StorageDead(_109);
- StorageLive(_115);
+ StorageLive(_114);
+- StorageLive(_115);
++ nop;
StorageLive(_116);
-- StorageLive(_117);
-- StorageLive(_118);
-- _118 = _1;
-- StorageLive(_119);
-- _119 = _2;
-- _117 = Shr(move _118, move _119);
-- StorageDead(_119);
-- StorageDead(_118);
- StorageLive(_120);
- _120 = _3;
-- _116 = Add(move _117, move _120);
-+ _116 = Add(_43, move _120);
- StorageDead(_120);
-- StorageDead(_117);
- _115 = opaque::<u64>(move _116) -> [return: bb28, unwind unreachable];
+ 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];
}
- bb28: {
- StorageDead(_116);
- StorageDead(_115);
+ bb33: {
+- StorageDead(_115);
++ nop;
+ StorageDead(_114);
+ StorageLive(_120);
StorageLive(_121);
-- StorageLive(_122);
-- StorageLive(_123);
-- _123 = _1;
-- _122 = S::<u64>(move _123);
-- StorageDead(_123);
-- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind unreachable];
-+ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind unreachable];
+ 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];
}
- bb29: {
-- StorageDead(_122);
+ bb34: {
StorageDead(_121);
- StorageLive(_124);
-- StorageLive(_125);
+ StorageDead(_120);
- StorageLive(_126);
-- StorageLive(_127);
-- _127 = _1;
-- _126 = S::<u64>(move _127);
-- StorageDead(_127);
-- _125 = (_126.0: u64);
-- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind unreachable];
-+ _124 = opaque::<u64>(_56) -> [return: bb30, unwind unreachable];
- }
-
- bb30: {
-- StorageDead(_125);
-- StorageDead(_126);
- StorageDead(_124);
- StorageLive(_128);
- _128 = &_3;
- StorageLive(_129);
-- StorageLive(_130);
-- StorageLive(_131);
- _131 = (*_128);
-- StorageLive(_132);
-- _132 = _1;
-- _130 = Add(move _131, move _132);
-- StorageDead(_132);
-- StorageDead(_131);
-- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind unreachable];
-+ _130 = Add(_131, _1);
-+ _129 = opaque::<u64>(_130) -> [return: bb31, unwind unreachable];
++ 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];
}
- bb31: {
-- StorageDead(_130);
- StorageDead(_129);
+ bb35: {
+- StorageDead(_128);
++ nop;
+ StorageDead(_127);
+ StorageLive(_131);
+ StorageLive(_132);
StorageLive(_133);
-- StorageLive(_134);
-- StorageLive(_135);
-- _135 = (*_128);
-- StorageLive(_136);
-- _136 = _1;
-- _134 = Add(move _135, move _136);
-- StorageDead(_136);
-- StorageDead(_135);
-- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind unreachable];
-+ _133 = opaque::<u64>(_130) -> [return: bb32, unwind unreachable];
+- _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];
}
- bb32: {
-- StorageDead(_134);
- StorageDead(_133);
+ bb36: {
+ StorageDead(_132);
+ StorageDead(_131);
+- StorageLive(_135);
++ nop;
+ _135 = &mut _3;
+ StorageLive(_136);
StorageLive(_137);
- _137 = &mut _3;
StorageLive(_138);
+ _138 = (*_135);
StorageLive(_139);
- StorageLive(_140);
- _140 = (*_137);
-- StorageLive(_141);
-- _141 = _1;
-- _139 = Add(move _140, move _141);
-- StorageDead(_141);
-+ _139 = Add(move _140, _1);
- StorageDead(_140);
- _138 = opaque::<u64>(move _139) -> [return: bb33, unwind unreachable];
- }
-
- bb33: {
+ _139 = _1;
+- _137 = Add(move _138, move _139);
++ _137 = Add(move _138, _1);
StorageDead(_139);
StorageDead(_138);
- StorageLive(_142);
- StorageLive(_143);
- StorageLive(_144);
- _144 = (*_137);
-- StorageLive(_145);
-- _145 = _1;
-- _143 = Add(move _144, move _145);
-- StorageDead(_145);
-+ _143 = Add(move _144, _1);
- StorageDead(_144);
- _142 = opaque::<u64>(move _143) -> [return: bb34, unwind unreachable];
+ _136 = opaque::<u64>(move _137) -> [return: bb37, unwind unreachable];
}
- bb34: {
+ 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);
-- StorageLive(_146);
+ _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);
- _147 = &raw const _3;
StorageLive(_148);
+ _148 = (*_145);
StorageLive(_149);
- StorageLive(_150);
- _150 = (*_147);
-- StorageLive(_151);
-- _151 = _1;
-- _149 = Add(move _150, move _151);
-- StorageDead(_151);
-+ _149 = Add(move _150, _1);
- StorageDead(_150);
- _148 = opaque::<u64>(move _149) -> [return: bb35, unwind unreachable];
- }
-
- bb35: {
+ _149 = _1;
+- _147 = Add(move _148, move _149);
++ _147 = Add(move _148, _1);
StorageDead(_149);
StorageDead(_148);
- StorageLive(_152);
- StorageLive(_153);
- StorageLive(_154);
- _154 = (*_147);
-- StorageLive(_155);
-- _155 = _1;
-- _153 = Add(move _154, move _155);
-- StorageDead(_155);
-+ _153 = Add(move _154, _1);
- StorageDead(_154);
- _152 = opaque::<u64>(move _153) -> [return: bb36, unwind unreachable];
+ _146 = opaque::<u64>(move _147) -> [return: bb39, unwind unreachable];
}
- bb36: {
+ 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);
- _156 = &raw mut _3;
StorageLive(_157);
+ _157 = (*_154);
StorageLive(_158);
- StorageLive(_159);
- _159 = (*_156);
-- StorageLive(_160);
-- _160 = _1;
-- _158 = Add(move _159, move _160);
-- StorageDead(_160);
-+ _158 = Add(move _159, _1);
- StorageDead(_159);
- _157 = opaque::<u64>(move _158) -> [return: bb37, unwind unreachable];
- }
-
- bb37: {
+ _158 = _1;
+- _156 = Add(move _157, move _158);
++ _156 = Add(move _157, _1);
StorageDead(_158);
StorageDead(_157);
- StorageLive(_161);
- StorageLive(_162);
- StorageLive(_163);
- _163 = (*_156);
-- StorageLive(_164);
-- _164 = _1;
-- _162 = Add(move _163, move _164);
-- StorageDead(_164);
-+ _162 = Add(move _163, _1);
- StorageDead(_163);
- _161 = opaque::<u64>(move _162) -> [return: bb38, unwind unreachable];
+ _155 = opaque::<u64>(move _156) -> [return: bb41, unwind unreachable];
}
- bb38: {
+ 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);
-- _146 = const ();
- StorageDead(_156);
- StorageDead(_147);
-- StorageDead(_146);
- StorageLive(_165);
- _165 = &_3;
- StorageLive(_166);
-- StorageLive(_167);
-- StorageLive(_168);
- _168 = (*_165);
-- StorageLive(_169);
-- _169 = _1;
-- _167 = Add(move _168, move _169);
-- StorageDead(_169);
-- StorageDead(_168);
-- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind unreachable];
-+ _167 = Add(_168, _1);
-+ _166 = opaque::<u64>(_167) -> [return: bb39, unwind unreachable];
+ _159 = opaque::<u64>(move _160) -> [return: bb42, unwind unreachable];
}
- bb39: {
-- StorageDead(_167);
- StorageDead(_166);
+ 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);
-- StorageLive(_171);
-- StorageLive(_172);
-- _172 = (*_165);
-- StorageLive(_173);
-- _173 = _1;
-- _171 = Add(move _172, move _173);
-- StorageDead(_173);
-- StorageDead(_172);
-- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind unreachable];
-+ _170 = opaque::<u64>(_167) -> [return: bb40, unwind unreachable];
+- _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];
}
- bb40: {
-- StorageDead(_171);
- StorageDead(_170);
+ bb44: {
+ StorageDead(_169);
+ StorageDead(_168);
_0 = const ();
- StorageDead(_165);
- StorageDead(_137);
- StorageDead(_128);
+- 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
index 68b052907..119a4d9bb 100644
--- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff
@@ -65,11 +65,11 @@
let mut _60: u64;
let mut _61: u64;
let mut _62: u64;
- let mut _63: u64;
+ let _63: ();
let mut _64: u64;
- let _65: ();
+ let mut _65: u64;
let mut _66: u64;
- let mut _67: u64;
+ let _67: ();
let mut _68: u64;
let mut _69: u64;
let mut _70: u64;
@@ -77,25 +77,25 @@
let mut _72: u64;
let mut _73: u64;
let mut _74: u64;
- let mut _75: u64;
- let mut _76: u64;
- let _77: ();
+ let mut _75: bool;
+ let _76: ();
+ let mut _77: u64;
let mut _78: u64;
let mut _79: u64;
- let mut _80: u64;
- let mut _81: u64;
- let mut _82: bool;
+ let mut _80: bool;
+ let _81: ();
+ let mut _82: u64;
let mut _83: u64;
- let _84: ();
- let mut _85: u64;
+ let mut _84: u64;
+ let _85: ();
let mut _86: u64;
let mut _87: u64;
let mut _88: u64;
- let mut _89: bool;
+ let _89: ();
let mut _90: u64;
- let _91: ();
+ let mut _91: u64;
let mut _92: u64;
- let mut _93: u64;
+ let _93: ();
let mut _94: u64;
let mut _95: u64;
let mut _96: u64;
@@ -103,93 +103,91 @@
let mut _98: u64;
let mut _99: u64;
let mut _100: u64;
- let mut _101: u64;
- let mut _102: u64;
- let _103: ();
- let mut _104: u64;
- let mut _105: u64;
+ let _101: ();
+ let mut _102: u32;
+ let mut _103: u64;
+ let _104: ();
+ let mut _105: f32;
let mut _106: u64;
- let mut _107: u64;
- let mut _108: u64;
- let _109: ();
- let mut _110: u64;
+ let _107: ();
+ let mut _108: S<u64>;
+ let mut _109: u64;
+ let _110: ();
let mut _111: u64;
- let mut _112: u64;
+ let mut _112: S<u64>;
let mut _113: u64;
- let mut _114: u64;
- let _115: ();
+ let _114: ();
+ let mut _115: u64;
let mut _116: u64;
let mut _117: u64;
let mut _118: u64;
let mut _119: u64;
- let mut _120: u64;
- let _121: ();
- let mut _122: S<u64>;
+ let _120: ();
+ let mut _121: u64;
+ let mut _122: u64;
let mut _123: u64;
- let _124: ();
+ let mut _124: u64;
let mut _125: u64;
- let mut _126: S<u64>;
- let mut _127: u64;
- let _128: &u64;
- let _129: ();
+ let _126: &u64;
+ let _127: ();
+ let mut _128: u64;
+ let mut _129: u64;
let mut _130: u64;
- let mut _131: u64;
+ let _131: ();
let mut _132: u64;
- let _133: ();
+ let mut _133: u64;
let mut _134: u64;
- let mut _135: u64;
- let mut _136: u64;
- let _138: ();
+ let _136: ();
+ let mut _137: u64;
+ let mut _138: u64;
let mut _139: u64;
- let mut _140: u64;
+ let _140: ();
let mut _141: u64;
- let _142: ();
+ let mut _142: u64;
let mut _143: u64;
- let mut _144: u64;
- let mut _145: u64;
+ let _144: ();
let _146: ();
- let _148: ();
+ let mut _147: u64;
+ let mut _148: u64;
let mut _149: u64;
- let mut _150: u64;
+ let _150: ();
let mut _151: u64;
- let _152: ();
+ let mut _152: u64;
let mut _153: u64;
- let mut _154: u64;
- let mut _155: u64;
- let _157: ();
+ let _155: ();
+ let mut _156: u64;
+ let mut _157: u64;
let mut _158: u64;
- let mut _159: u64;
+ let _159: ();
let mut _160: u64;
- let _161: ();
+ let mut _161: u64;
let mut _162: u64;
- let mut _163: u64;
- let mut _164: u64;
- let _166: ();
+ let _164: ();
+ let mut _165: u64;
+ let mut _166: u64;
let mut _167: u64;
- let mut _168: u64;
+ let _168: ();
let mut _169: u64;
- let _170: ();
+ let mut _170: u64;
let mut _171: u64;
- let mut _172: u64;
- let mut _173: u64;
scope 1 {
- debug a => _128;
- let _137: &mut u64;
+ debug a => _126;
+ let _135: &mut u64;
scope 2 {
- debug b => _137;
- let _165: &u64;
+ debug b => _135;
+ let _163: &u64;
scope 3 {
- let _147: *const u64;
+ let _145: *const u64;
scope 4 {
- debug c => _147;
- let _156: *mut u64;
+ debug c => _145;
+ let _154: *mut u64;
scope 5 {
- debug d => _156;
+ debug d => _154;
}
}
}
scope 6 {
- debug e => _165;
+ debug e => _163;
}
}
}
@@ -197,61 +195,68 @@
bb0: {
StorageLive(_4);
- StorageLive(_5);
-- StorageLive(_6);
-- _6 = _1;
-- StorageLive(_7);
-- _7 = _2;
++ nop;
+ StorageLive(_6);
+ _6 = _1;
+ StorageLive(_7);
+ _7 = _2;
- _5 = Add(move _6, move _7);
-- StorageDead(_7);
-- StorageDead(_6);
-- _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue];
+ _5 = Add(_1, _2);
+ 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);
-- StorageLive(_10);
-- _10 = _1;
-- StorageLive(_11);
-- _11 = _2;
++ nop;
+ StorageLive(_10);
+ _10 = _1;
+ StorageLive(_11);
+ _11 = _2;
- _9 = Mul(move _10, move _11);
-- StorageDead(_11);
-- StorageDead(_10);
-- _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue];
+ _9 = Mul(_1, _2);
+ 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);
-- StorageLive(_14);
-- _14 = _1;
-- StorageLive(_15);
-- _15 = _2;
++ nop;
+ StorageLive(_14);
+ _14 = _1;
+ StorageLive(_15);
+ _15 = _2;
- _13 = Sub(move _14, move _15);
-- StorageDead(_15);
-- StorageDead(_14);
-- _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue];
+ _13 = Sub(_1, _2);
+ 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);
-- StorageLive(_18);
-- _18 = _1;
-- StorageLive(_19);
-- _19 = _2;
++ 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);
@@ -260,623 +265,701 @@
bb4: {
- _17 = Div(move _18, move _19);
-- StorageDead(_19);
-- StorageDead(_18);
-- _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue];
+ _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);
-- StorageLive(_23);
-- _23 = _1;
-- StorageLive(_24);
-- _24 = _2;
++ 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);
-- StorageDead(_24);
-- StorageDead(_23);
-- _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue];
+ _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);
-- StorageLive(_28);
-- _28 = _1;
-- StorageLive(_29);
-- _29 = _2;
++ nop;
+ StorageLive(_28);
+ _28 = _1;
+ StorageLive(_29);
+ _29 = _2;
- _27 = BitAnd(move _28, move _29);
-- StorageDead(_29);
-- StorageDead(_28);
-- _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue];
+ _27 = BitAnd(_1, _2);
+ 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);
-- StorageLive(_32);
-- _32 = _1;
-- StorageLive(_33);
-- _33 = _2;
++ nop;
+ StorageLive(_32);
+ _32 = _1;
+ StorageLive(_33);
+ _33 = _2;
- _31 = BitOr(move _32, move _33);
-- StorageDead(_33);
-- StorageDead(_32);
-- _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue];
+ _31 = BitOr(_1, _2);
+ 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);
-- StorageLive(_36);
-- _36 = _1;
-- StorageLive(_37);
-- _37 = _2;
++ nop;
+ StorageLive(_36);
+ _36 = _1;
+ StorageLive(_37);
+ _37 = _2;
- _35 = BitXor(move _36, move _37);
-- StorageDead(_37);
-- StorageDead(_36);
-- _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue];
+ _35 = BitXor(_1, _2);
+ 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);
-- StorageLive(_40);
-- _40 = _1;
-- StorageLive(_41);
-- _41 = _2;
++ nop;
+ StorageLive(_40);
+ _40 = _1;
+ StorageLive(_41);
+ _41 = _2;
- _39 = Shl(move _40, move _41);
-- StorageDead(_41);
-- StorageDead(_40);
-- _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue];
+ _39 = Shl(_1, _2);
+ 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);
-- StorageLive(_44);
-- _44 = _1;
-- StorageLive(_45);
-- _45 = _2;
++ nop;
+ StorageLive(_44);
+ _44 = _1;
+ StorageLive(_45);
+ _45 = _2;
- _43 = Shr(move _44, move _45);
-- StorageDead(_45);
-- StorageDead(_44);
-- _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue];
+ _43 = Shr(_1, _2);
+ 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);
-- StorageLive(_48);
-- _48 = _1;
+- StorageLive(_47);
++ nop;
+ StorageLive(_48);
+ _48 = _1;
- _47 = move _48 as u32 (IntToInt);
-- StorageDead(_48);
+ _47 = _1 as u32 (IntToInt);
- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
+ StorageDead(_48);
+- _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue];
++ _46 = opaque::<u32>(_47) -> [return: bb13, unwind continue];
}
bb13: {
- StorageDead(_47);
+- StorageDead(_47);
++ nop;
StorageDead(_46);
StorageLive(_49);
- StorageLive(_50);
-- StorageLive(_51);
-- _51 = _1;
+- StorageLive(_50);
++ nop;
+ StorageLive(_51);
+ _51 = _1;
- _50 = move _51 as f32 (IntToFloat);
-- StorageDead(_51);
+ _50 = _1 as f32 (IntToFloat);
- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
+ StorageDead(_51);
+- _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue];
++ _49 = opaque::<f32>(_50) -> [return: bb14, unwind continue];
}
bb14: {
- StorageDead(_50);
+- StorageDead(_50);
++ nop;
StorageDead(_49);
StorageLive(_52);
- StorageLive(_53);
-- StorageLive(_54);
-- _54 = _1;
++ nop;
+ StorageLive(_54);
+ _54 = _1;
- _53 = S::<u64>(move _54);
-- StorageDead(_54);
-- _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue];
+ _53 = S::<u64>(_1);
+ 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;
+ StorageLive(_56);
+ StorageLive(_57);
+ StorageLive(_58);
+ _58 = _1;
- _57 = S::<u64>(move _58);
-- StorageDead(_58);
++ _57 = _53;
+ StorageDead(_58);
- _56 = (_57.0: u64);
- _55 = opaque::<u64>(move _56) -> [return: bb16, unwind continue];
-+ _56 = (_53.0: u64);
-+ _55 = opaque::<u64>(_56) -> [return: bb16, unwind continue];
++ _56 = _1;
++ _55 = opaque::<u64>(_1) -> [return: bb16, unwind continue];
}
bb16: {
-- StorageDead(_56);
-- StorageDead(_57);
+ StorageDead(_56);
+ StorageDead(_57);
StorageDead(_55);
StorageLive(_59);
StorageLive(_60);
-- StorageLive(_61);
-- StorageLive(_62);
-- _62 = _1;
-- StorageLive(_63);
-- _63 = _2;
-- _61 = Add(move _62, move _63);
-- StorageDead(_63);
-- StorageDead(_62);
- StorageLive(_64);
- _64 = _3;
-- _60 = Add(move _61, move _64);
-+ _60 = Add(_5, move _64);
- StorageDead(_64);
-- StorageDead(_61);
- _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue];
+ 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);
-- StorageLive(_67);
-- StorageLive(_68);
-- _68 = _1;
-- StorageLive(_69);
-- _69 = _2;
-- _67 = Mul(move _68, move _69);
-- StorageDead(_69);
-- StorageDead(_68);
+ _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 = _3;
-- _66 = Add(move _67, move _70);
-+ _66 = Add(_9, move _70);
+ _70 = _2;
+- _68 = Sub(move _69, move _70);
++ _68 = _13;
StorageDead(_70);
-- StorageDead(_67);
- _65 = opaque::<u64>(move _66) -> [return: bb18, unwind continue];
+ StorageDead(_69);
+- _67 = opaque::<u64>(move _68) -> [return: bb19, unwind continue];
++ _67 = opaque::<u64>(_13) -> [return: bb19, unwind continue];
}
- bb18: {
- StorageDead(_66);
- StorageDead(_65);
+ bb19: {
+ StorageDead(_68);
+ StorageDead(_67);
StorageLive(_71);
StorageLive(_72);
-- StorageLive(_73);
-- StorageLive(_74);
-- _74 = _1;
-- StorageLive(_75);
-- _75 = _2;
-- _73 = Sub(move _74, move _75);
-- StorageDead(_75);
-- StorageDead(_74);
- StorageLive(_76);
- _76 = _3;
-- _72 = Add(move _73, move _76);
-+ _72 = Add(_13, move _76);
- StorageDead(_76);
-- StorageDead(_73);
- _71 = opaque::<u64>(move _72) -> [return: bb19, unwind continue];
+ 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];
}
- bb19: {
+ 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);
-- StorageLive(_79);
-- StorageLive(_80);
-- _80 = _1;
-- StorageLive(_81);
-- _81 = _2;
-- _82 = Eq(_81, const 0_u64);
-- assert(!move _82, "attempt to divide `{}` by zero", _80) -> [success: bb20, unwind continue];
-+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue];
+ _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];
}
- bb20: {
-- _79 = Div(move _80, move _81);
-- StorageDead(_81);
-- StorageDead(_80);
- StorageLive(_83);
- _83 = _3;
-- _78 = Add(move _79, move _83);
-+ _78 = Add(_17, move _83);
- StorageDead(_83);
-- StorageDead(_79);
- _77 = opaque::<u64>(move _78) -> [return: bb21, unwind continue];
+ 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];
}
- bb21: {
- StorageDead(_78);
+ bb23: {
StorageDead(_77);
+ StorageDead(_76);
+ StorageLive(_81);
+ StorageLive(_82);
+ StorageLive(_83);
+ _83 = _1;
StorageLive(_84);
- StorageLive(_85);
-- StorageLive(_86);
-- StorageLive(_87);
-- _87 = _1;
-- StorageLive(_88);
-- _88 = _2;
-- _89 = Eq(_88, const 0_u64);
-- assert(!move _89, "attempt to calculate the remainder of `{}` with a divisor of zero", _87) -> [success: bb22, unwind continue];
-+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue];
+ _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];
}
- bb22: {
-- _86 = Rem(move _87, move _88);
-- StorageDead(_88);
-- StorageDead(_87);
- StorageLive(_90);
- _90 = _3;
-- _85 = Add(move _86, move _90);
-+ _85 = Add(_22, move _90);
- StorageDead(_90);
-- StorageDead(_86);
- _84 = opaque::<u64>(move _85) -> [return: bb23, unwind continue];
+ 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];
}
- bb23: {
+ bb25: {
+ StorageDead(_86);
StorageDead(_85);
- StorageDead(_84);
+ StorageLive(_89);
+ StorageLive(_90);
StorageLive(_91);
+ _91 = _1;
StorageLive(_92);
-- StorageLive(_93);
-- StorageLive(_94);
-- _94 = _1;
-- StorageLive(_95);
-- _95 = _2;
-- _93 = BitAnd(move _94, move _95);
-- StorageDead(_95);
-- StorageDead(_94);
+ _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 = _3;
-- _92 = Add(move _93, move _96);
-+ _92 = Add(_27, move _96);
+ _96 = _2;
+- _94 = Shl(move _95, move _96);
++ _94 = _39;
StorageDead(_96);
-- StorageDead(_93);
- _91 = opaque::<u64>(move _92) -> [return: bb24, unwind continue];
+ StorageDead(_95);
+- _93 = opaque::<u64>(move _94) -> [return: bb27, unwind continue];
++ _93 = opaque::<u64>(_39) -> [return: bb27, unwind continue];
}
- bb24: {
- StorageDead(_92);
- StorageDead(_91);
+ bb27: {
+ StorageDead(_94);
+ StorageDead(_93);
StorageLive(_97);
StorageLive(_98);
-- StorageLive(_99);
-- StorageLive(_100);
-- _100 = _1;
-- StorageLive(_101);
-- _101 = _2;
-- _99 = BitOr(move _100, move _101);
-- StorageDead(_101);
-- StorageDead(_100);
- StorageLive(_102);
- _102 = _3;
-- _98 = Add(move _99, move _102);
-+ _98 = Add(_31, move _102);
- StorageDead(_102);
-- StorageDead(_99);
- _97 = opaque::<u64>(move _98) -> [return: bb25, unwind continue];
+ 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];
}
- bb25: {
+ 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;
-- StorageLive(_107);
-- _107 = _2;
-- _105 = BitXor(move _106, move _107);
-- StorageDead(_107);
-- StorageDead(_106);
- StorageLive(_108);
- _108 = _3;
-- _104 = Add(move _105, move _108);
-+ _104 = Add(_35, move _108);
- StorageDead(_108);
-- StorageDead(_105);
- _103 = opaque::<u64>(move _104) -> [return: bb26, unwind continue];
+ 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];
}
- bb26: {
+ bb30: {
+ StorageDead(_105);
StorageDead(_104);
- StorageDead(_103);
+ 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);
-- _112 = _1;
-- StorageLive(_113);
-- _113 = _2;
-- _111 = Shl(move _112, move _113);
-- StorageDead(_113);
-- StorageDead(_112);
- StorageLive(_114);
- _114 = _3;
-- _110 = Add(move _111, move _114);
-+ _110 = Add(_39, move _114);
- StorageDead(_114);
-- StorageDead(_111);
- _109 = opaque::<u64>(move _110) -> [return: bb27, unwind continue];
+ 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];
}
- bb27: {
+ bb32: {
+ StorageDead(_111);
+ StorageDead(_112);
StorageDead(_110);
- StorageDead(_109);
- StorageLive(_115);
+ StorageLive(_114);
+- StorageLive(_115);
++ nop;
StorageLive(_116);
-- StorageLive(_117);
-- StorageLive(_118);
-- _118 = _1;
-- StorageLive(_119);
-- _119 = _2;
-- _117 = Shr(move _118, move _119);
-- StorageDead(_119);
-- StorageDead(_118);
- StorageLive(_120);
- _120 = _3;
-- _116 = Add(move _117, move _120);
-+ _116 = Add(_43, move _120);
- StorageDead(_120);
-- StorageDead(_117);
- _115 = opaque::<u64>(move _116) -> [return: bb28, unwind continue];
+ 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];
}
- bb28: {
- StorageDead(_116);
- StorageDead(_115);
+ bb33: {
+- StorageDead(_115);
++ nop;
+ StorageDead(_114);
+ StorageLive(_120);
StorageLive(_121);
-- StorageLive(_122);
-- StorageLive(_123);
-- _123 = _1;
-- _122 = S::<u64>(move _123);
-- StorageDead(_123);
-- _121 = opaque::<S<u64>>(move _122) -> [return: bb29, unwind continue];
-+ _121 = opaque::<S<u64>>(_53) -> [return: bb29, unwind continue];
+ 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];
}
- bb29: {
-- StorageDead(_122);
+ bb34: {
StorageDead(_121);
- StorageLive(_124);
-- StorageLive(_125);
+ StorageDead(_120);
- StorageLive(_126);
-- StorageLive(_127);
-- _127 = _1;
-- _126 = S::<u64>(move _127);
-- StorageDead(_127);
-- _125 = (_126.0: u64);
-- _124 = opaque::<u64>(move _125) -> [return: bb30, unwind continue];
-+ _124 = opaque::<u64>(_56) -> [return: bb30, unwind continue];
- }
-
- bb30: {
-- StorageDead(_125);
-- StorageDead(_126);
- StorageDead(_124);
- StorageLive(_128);
- _128 = &_3;
- StorageLive(_129);
-- StorageLive(_130);
-- StorageLive(_131);
- _131 = (*_128);
-- StorageLive(_132);
-- _132 = _1;
-- _130 = Add(move _131, move _132);
-- StorageDead(_132);
-- StorageDead(_131);
-- _129 = opaque::<u64>(move _130) -> [return: bb31, unwind continue];
-+ _130 = Add(_131, _1);
-+ _129 = opaque::<u64>(_130) -> [return: bb31, unwind continue];
++ 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];
}
- bb31: {
-- StorageDead(_130);
- StorageDead(_129);
+ bb35: {
+- StorageDead(_128);
++ nop;
+ StorageDead(_127);
+ StorageLive(_131);
+ StorageLive(_132);
StorageLive(_133);
-- StorageLive(_134);
-- StorageLive(_135);
-- _135 = (*_128);
-- StorageLive(_136);
-- _136 = _1;
-- _134 = Add(move _135, move _136);
-- StorageDead(_136);
-- StorageDead(_135);
-- _133 = opaque::<u64>(move _134) -> [return: bb32, unwind continue];
-+ _133 = opaque::<u64>(_130) -> [return: bb32, unwind continue];
+- _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];
}
- bb32: {
-- StorageDead(_134);
- StorageDead(_133);
+ bb36: {
+ StorageDead(_132);
+ StorageDead(_131);
+- StorageLive(_135);
++ nop;
+ _135 = &mut _3;
+ StorageLive(_136);
StorageLive(_137);
- _137 = &mut _3;
StorageLive(_138);
+ _138 = (*_135);
StorageLive(_139);
- StorageLive(_140);
- _140 = (*_137);
-- StorageLive(_141);
-- _141 = _1;
-- _139 = Add(move _140, move _141);
-- StorageDead(_141);
-+ _139 = Add(move _140, _1);
- StorageDead(_140);
- _138 = opaque::<u64>(move _139) -> [return: bb33, unwind continue];
- }
-
- bb33: {
+ _139 = _1;
+- _137 = Add(move _138, move _139);
++ _137 = Add(move _138, _1);
StorageDead(_139);
StorageDead(_138);
- StorageLive(_142);
- StorageLive(_143);
- StorageLive(_144);
- _144 = (*_137);
-- StorageLive(_145);
-- _145 = _1;
-- _143 = Add(move _144, move _145);
-- StorageDead(_145);
-+ _143 = Add(move _144, _1);
- StorageDead(_144);
- _142 = opaque::<u64>(move _143) -> [return: bb34, unwind continue];
+ _136 = opaque::<u64>(move _137) -> [return: bb37, unwind continue];
}
- bb34: {
+ 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);
-- StorageLive(_146);
+ _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);
- _147 = &raw const _3;
StorageLive(_148);
+ _148 = (*_145);
StorageLive(_149);
- StorageLive(_150);
- _150 = (*_147);
-- StorageLive(_151);
-- _151 = _1;
-- _149 = Add(move _150, move _151);
-- StorageDead(_151);
-+ _149 = Add(move _150, _1);
- StorageDead(_150);
- _148 = opaque::<u64>(move _149) -> [return: bb35, unwind continue];
- }
-
- bb35: {
+ _149 = _1;
+- _147 = Add(move _148, move _149);
++ _147 = Add(move _148, _1);
StorageDead(_149);
StorageDead(_148);
- StorageLive(_152);
- StorageLive(_153);
- StorageLive(_154);
- _154 = (*_147);
-- StorageLive(_155);
-- _155 = _1;
-- _153 = Add(move _154, move _155);
-- StorageDead(_155);
-+ _153 = Add(move _154, _1);
- StorageDead(_154);
- _152 = opaque::<u64>(move _153) -> [return: bb36, unwind continue];
+ _146 = opaque::<u64>(move _147) -> [return: bb39, unwind continue];
}
- bb36: {
+ 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);
- _156 = &raw mut _3;
StorageLive(_157);
+ _157 = (*_154);
StorageLive(_158);
- StorageLive(_159);
- _159 = (*_156);
-- StorageLive(_160);
-- _160 = _1;
-- _158 = Add(move _159, move _160);
-- StorageDead(_160);
-+ _158 = Add(move _159, _1);
- StorageDead(_159);
- _157 = opaque::<u64>(move _158) -> [return: bb37, unwind continue];
- }
-
- bb37: {
+ _158 = _1;
+- _156 = Add(move _157, move _158);
++ _156 = Add(move _157, _1);
StorageDead(_158);
StorageDead(_157);
- StorageLive(_161);
- StorageLive(_162);
- StorageLive(_163);
- _163 = (*_156);
-- StorageLive(_164);
-- _164 = _1;
-- _162 = Add(move _163, move _164);
-- StorageDead(_164);
-+ _162 = Add(move _163, _1);
- StorageDead(_163);
- _161 = opaque::<u64>(move _162) -> [return: bb38, unwind continue];
+ _155 = opaque::<u64>(move _156) -> [return: bb41, unwind continue];
}
- bb38: {
+ 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);
-- _146 = const ();
- StorageDead(_156);
- StorageDead(_147);
-- StorageDead(_146);
- StorageLive(_165);
- _165 = &_3;
- StorageLive(_166);
-- StorageLive(_167);
-- StorageLive(_168);
- _168 = (*_165);
-- StorageLive(_169);
-- _169 = _1;
-- _167 = Add(move _168, move _169);
-- StorageDead(_169);
-- StorageDead(_168);
-- _166 = opaque::<u64>(move _167) -> [return: bb39, unwind continue];
-+ _167 = Add(_168, _1);
-+ _166 = opaque::<u64>(_167) -> [return: bb39, unwind continue];
+ _159 = opaque::<u64>(move _160) -> [return: bb42, unwind continue];
}
- bb39: {
-- StorageDead(_167);
- StorageDead(_166);
+ 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);
-- StorageLive(_171);
-- StorageLive(_172);
-- _172 = (*_165);
-- StorageLive(_173);
-- _173 = _1;
-- _171 = Add(move _172, move _173);
-- StorageDead(_173);
-- StorageDead(_172);
-- _170 = opaque::<u64>(move _171) -> [return: bb40, unwind continue];
-+ _170 = opaque::<u64>(_167) -> [return: bb40, unwind continue];
+- _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];
}
- bb40: {
-- StorageDead(_171);
- StorageDead(_170);
+ bb44: {
+ StorageDead(_169);
+ StorageDead(_168);
_0 = const ();
- StorageDead(_165);
- StorageDead(_137);
- StorageDead(_128);
+- 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
index f33845502..62710ba8f 100644
--- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff
@@ -15,13 +15,15 @@
bb0: {
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ StorageLive(_3);
+ _3 = _1;
- _2 = Option::<T>::Some(move _3);
-- StorageDead(_3);
+ _2 = Option::<T>::Some(_1);
- _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ 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: {
@@ -34,10 +36,12 @@
}
bb3: {
-- StorageLive(_5);
- _5 = ((_2 as Some).0: T);
- _0 = _5;
-- StorageDead(_5);
+ 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
index edc05f99f..ad46a065b 100644
--- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
+++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff
@@ -15,13 +15,15 @@
bb0: {
StorageLive(_2);
-- StorageLive(_3);
-- _3 = _1;
+ StorageLive(_3);
+ _3 = _1;
- _2 = Option::<T>::Some(move _3);
-- StorageDead(_3);
+ _2 = Option::<T>::Some(_1);
- _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2];
+ 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: {
@@ -34,10 +36,12 @@
}
bb3: {
-- StorageLive(_5);
- _5 = ((_2 as Some).0: T);
- _0 = _5;
-- StorageDead(_5);
+ 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.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.rs b/tests/mir-opt/inline/asm_unwind.rs
index 573ae1ba6..0ae20e522 100644
--- a/tests/mir-opt/inline/asm_unwind.rs
+++ b/tests/mir-opt/inline/asm_unwind.rs
@@ -2,6 +2,7 @@
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// needs-asm-support
+// needs-unwind
// compile-flags: -Zinline-mir-hint-threshold=1000
#![feature(asm_unwind)]
@@ -19,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.rs b/tests/mir-opt/inline/caller_with_trivial_bound.rs
index a8f101d48..40f7f4bba 100644
--- a/tests/mir-opt/inline/caller_with_trivial_bound.rs
+++ b/tests/mir-opt/inline/caller_with_trivial_bound.rs
@@ -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.rs b/tests/mir-opt/inline/cycle.rs
index 1b74d8184..350724235 100644
--- a/tests/mir-opt/inline/cycle.rs
+++ b/tests/mir-opt/inline/cycle.rs
@@ -4,16 +4,26 @@
// 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.rs b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
index 971223c72..ce5e1855a 100644
--- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
+++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.rs
@@ -7,5 +7,7 @@ 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.rs b/tests/mir-opt/inline/dyn_trait.rs
index 0faeec0bb..ecf220a85 100644
--- a/tests/mir-opt/inline/dyn_trait.rs
+++ b/tests/mir-opt/inline/dyn_trait.rs
@@ -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/exponential_runtime.rs b/tests/mir-opt/inline/exponential_runtime.rs
index cfa9ff210..1199ce4e5 100644
--- a/tests/mir-opt/inline/exponential_runtime.rs
+++ b/tests/mir-opt/inline/exponential_runtime.rs
@@ -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/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.rs b/tests/mir-opt/inline/inline_box_fn.rs
index 348f0e77f..d2da23939 100644
--- a/tests/mir-opt/inline/inline_box_fn.rs
+++ b/tests/mir-opt/inline/inline_box_fn.rs
@@ -4,5 +4,7 @@
// 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.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.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 721fac27d..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
@@ -41,6 +41,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_7 = (move _8,);
StorageLive(_9);
_9 = move (_7.0: i32);
+ StorageLive(_10);
+ StorageLive(_12);
StorageLive(_11);
_10 = ((*_6).0: &i32);
_11 = (*_10);
@@ -50,6 +52,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
_0 = (move _11, move _13);
StorageDead(_13);
StorageDead(_11);
+ StorageDead(_12);
+ StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
StorageDead(_7);
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.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff
deleted file mode 100644
index eac51000c..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-abort.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_no_sanitize` before Inline
-+ // MIR for `inlined_no_sanitize` after Inline
-
- fn inlined_no_sanitize() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined no_sanitize) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = no_sanitize() -> [return: bb1, unwind unreachable];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff
deleted file mode 100644
index eba5ad9cf..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_no_sanitize` before Inline
-+ // MIR for `inlined_no_sanitize` after Inline
-
- fn inlined_no_sanitize() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined no_sanitize) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = no_sanitize() -> [return: bb1, unwind continue];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff
deleted file mode 100644
index c2a81b980..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-abort.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_target_feature` before Inline
-+ // MIR for `inlined_target_feature` after Inline
-
- fn inlined_target_feature() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined target_feature) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = target_feature() -> [return: bb1, unwind unreachable];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff
deleted file mode 100644
index 24457819b..000000000
--- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-- // MIR for `inlined_target_feature` before Inline
-+ // MIR for `inlined_target_feature` after Inline
-
- fn inlined_target_feature() -> () {
- let mut _0: ();
- let _1: ();
-+ scope 1 (inlined target_feature) {
-+ }
-
- bb0: {
- StorageLive(_1);
-- _1 = target_feature() -> [return: bb1, unwind continue];
-- }
--
-- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff
deleted file mode 100644
index 791c5a0f2..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-abort.diff
+++ /dev/null
@@ -1,22 +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: ();
- let _1: u32;
- scope 1 {
- debug s => _1;
- }
-
- bb0: {
- StorageLive(_1);
- _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- _0 = const ();
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff
deleted file mode 100644
index 364acab6d..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,22 +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: ();
- let _1: u32;
- scope 1 {
- debug s => _1;
- }
-
- bb0: {
- StorageLive(_1);
- _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> [return: bb1, unwind continue];
- }
-
- bb1: {
- _0 = const ();
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff
deleted file mode 100644
index b9d0946b7..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-abort.diff
+++ /dev/null
@@ -1,19 +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: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = no_sanitize() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff
deleted file mode 100644
index 965b7ddca..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,19 +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: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = no_sanitize() -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff
deleted file mode 100644
index 7c689a734..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-abort.diff
+++ /dev/null
@@ -1,19 +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: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = target_feature() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff
deleted file mode 100644
index bcdbd6e33..000000000
--- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,19 +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: ();
- let _1: ();
-
- bb0: {
- StorageLive(_1);
- _1 = target_feature() -> [return: bb1, unwind continue];
- }
-
- bb1: {
- StorageDead(_1);
- _0 = const ();
- return;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_compatibility.rs b/tests/mir-opt/inline/inline_compatibility.rs
index 1527fea1c..3ad880715 100644
--- a/tests/mir-opt/inline/inline_compatibility.rs
+++ b/tests/mir-opt/inline/inline_compatibility.rs
@@ -1,50 +1,71 @@
// Checks that only functions with compatible attributes are inlined.
-//
// only-x86_64
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+// 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..40eeda539
--- /dev/null
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
@@ -0,0 +1,112 @@
+- // 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(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_2);
++ drop(_4) -> [return: bb2, unwind unreachable];
+ }
+
+ 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(_4);
++ _0 = const ();
++ StorageDead(_1);
++ return;
+ }
+
+ 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);
++ discriminant((*_6)) = 3;
++ goto -> bb1;
++ }
++
++ 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 -> bb1;
++ }
++
++ 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..fdb42bf3d
--- /dev/null
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
@@ -0,0 +1,124 @@
+- // 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];
+- }
+-
+- bb1: {
++ _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}>::new(move _3) -> [return: bb2, unwind: bb5];
+- }
+-
+- bb2: {
++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:19:5: 19:8}> { pointer: move _3 };
+ StorageDead(_3);
+- _1 = <{coroutine@$DIR/inline_coroutine.rs:19:5: 19:8} as Coroutine<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
++ 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];
+ }
+
+- bb3: {
++ bb1: {
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
+ StorageDead(_2);
+- drop(_4) -> [return: bb4, unwind: bb6];
++ drop(_4) -> [return: bb2, unwind: bb4];
+ }
+
+- bb4: {
++ bb2: {
+ StorageDead(_4);
+ _0 = const ();
+ StorageDead(_1);
+ return;
+ }
+
+- bb5 (cleanup): {
+- drop(_4) -> [return: bb6, unwind terminate(cleanup)];
++ bb3 (cleanup): {
++ drop(_4) -> [return: bb4, unwind terminate(cleanup)];
+ }
+
+- bb6 (cleanup): {
++ bb4 (cleanup): {
+ resume;
++ }
++
++ bb5: {
++ StorageLive(_8);
++ switchInt(_5) -> [0: bb6, otherwise: bb7];
++ }
++
++ bb6: {
++ _8 = const 13_i32;
++ goto -> bb8;
++ }
++
++ bb7: {
++ _8 = const 7_i32;
++ goto -> bb8;
++ }
++
++ bb8: {
++ _1 = CoroutineState::<i32, bool>::Yielded(move _8);
++ discriminant((*_6)) = 3;
++ goto -> bb1;
++ }
++
++ bb9: {
++ assert(const false, "coroutine resumed after completion") -> [success: bb9, unwind: bb3];
++ }
++
++ bb10: {
++ StorageLive(_8);
++ StorageDead(_8);
++ _1 = CoroutineState::<i32, bool>::Complete(_5);
++ discriminant((*_6)) = 1;
++ goto -> bb1;
++ }
++
++ 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.rs b/tests/mir-opt/inline/inline_cycle.rs
index 42a6914c9..e3dd08255 100644
--- a/tests/mir-opt/inline/inline_cycle.rs
+++ b/tests/mir-opt/inline/inline_cycle.rs
@@ -1,3 +1,4 @@
+// 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
diff --git a/tests/mir-opt/inline/inline_cycle_generic.rs b/tests/mir-opt/inline/inline_cycle_generic.rs
index ef261b04c..667bf7f92 100644
--- a/tests/mir-opt/inline/inline_cycle_generic.rs
+++ b/tests/mir-opt/inline/inline_cycle_generic.rs
@@ -1,3 +1,4 @@
+// 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
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
index 7d5553b2f..da45ebcb4 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff
@@ -8,11 +8,11 @@
+ scope 1 (inlined call_twice::<!, fn() -> ! {sleep}>) {
+ debug f => _2;
+ let mut _3: &fn() -> ! {sleep};
-+ let mut _4: !;
++ let _4: !;
+ let mut _5: &fn() -> ! {sleep};
-+ let mut _6: !;
+ scope 2 {
+ debug a => _4;
++ let _6: !;
+ scope 3 {
+ debug b => _6;
+ }
diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
index 9f8c5806c..d65c65e5f 100644
--- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff
@@ -10,10 +10,10 @@
+ let mut _3: &fn() -> ! {sleep};
+ let _4: !;
+ let mut _5: &fn() -> ! {sleep};
-+ let mut _6: !;
+ let mut _7: !;
+ scope 2 {
+ debug a => _4;
++ let _6: !;
+ scope 3 {
+ debug b => _6;
+ }
diff --git a/tests/mir-opt/inline/inline_diverging.rs b/tests/mir-opt/inline/inline_diverging.rs
index e01c4c1dd..25a5b9c5c 100644
--- a/tests/mir-opt/inline/inline_diverging.rs
+++ b/tests/mir-opt/inline/inline_diverging.rs
@@ -6,6 +6,8 @@
// EMIT_MIR inline_diverging.f.Inline.diff
pub fn f() {
+ // CHECK-LABEL: fn f(
+ // CHECK: (inlined sleep)
sleep();
}
@@ -14,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.panic-abort.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
deleted file mode 100644
index 6779003b6..000000000
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-abort.diff
+++ /dev/null
@@ -1,108 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: ();
- let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
- let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
- let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
-+ let mut _5: bool;
- scope 1 {
- debug _r => _1;
- }
-+ scope 2 (inlined g) {
-+ }
-+ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
-+ debug pointer => _3;
-+ scope 4 {
-+ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
-+ debug pointer => _3;
-+ }
-+ }
-+ }
-+ scope 6 (inlined g::{closure#0}) {
-+ debug a => _5;
-+ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
-+ let mut _7: u32;
-+ let mut _8: i32;
-+ }
-
- bb0: {
- StorageLive(_1);
- StorageLive(_2);
- StorageLive(_3);
- StorageLive(_4);
-- _4 = g() -> [return: bb1, unwind unreachable];
-+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
-+ _3 = &mut _4;
-+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
-+ StorageDead(_3);
-+ StorageLive(_5);
-+ _5 = const false;
-+ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
-+ _7 = discriminant((*_6));
-+ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9];
- }
-
- bb1: {
-- _3 = &mut _4;
-- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind unreachable];
-+ StorageDead(_5);
-+ StorageDead(_2);
-+ drop(_4) -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
-- StorageDead(_3);
-- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind unreachable];
-+ StorageDead(_4);
-+ _0 = const ();
-+ StorageDead(_1);
-+ return;
- }
-
- bb3: {
-- StorageDead(_2);
-- drop(_4) -> [return: bb4, unwind unreachable];
-+ StorageLive(_8);
-+ switchInt(_5) -> [0: 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 = GeneratorState::<i32, bool>::Yielded(move _8);
-+ discriminant((*_6)) = 3;
-+ goto -> bb1;
-+ }
-+
-+ bb7: {
-+ assert(const false, "generator resumed after completion") -> [success: bb7, unwind unreachable];
-+ }
-+
-+ bb8: {
-+ StorageLive(_8);
-+ StorageDead(_8);
-+ _1 = GeneratorState::<i32, bool>::Complete(_5);
-+ discriminant((*_6)) = 1;
-+ goto -> bb1;
-+ }
-+
-+ bb9: {
-+ unreachable;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
deleted file mode 100644
index 31744be99..000000000
--- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff
+++ /dev/null
@@ -1,120 +0,0 @@
-- // MIR for `main` before Inline
-+ // MIR for `main` after Inline
-
- fn main() -> () {
- let mut _0: ();
- let _1: std::ops::GeneratorState<i32, bool>;
- let mut _2: std::pin::Pin<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>;
- let mut _3: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
- let mut _4: {generator@$DIR/inline_generator.rs:16:5: 16:8};
-+ let mut _5: bool;
- scope 1 {
- debug _r => _1;
- }
-+ scope 2 (inlined g) {
-+ }
-+ scope 3 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new) {
-+ debug pointer => _3;
-+ scope 4 {
-+ scope 5 (inlined Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new_unchecked) {
-+ debug pointer => _3;
-+ }
-+ }
-+ }
-+ scope 6 (inlined g::{closure#0}) {
-+ debug a => _5;
-+ let mut _6: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8};
-+ let mut _7: u32;
-+ let mut _8: i32;
-+ }
-
- bb0: {
- StorageLive(_1);
- StorageLive(_2);
- StorageLive(_3);
- StorageLive(_4);
-- _4 = g() -> [return: bb1, unwind continue];
-- }
--
-- bb1: {
-+ _4 = {generator@$DIR/inline_generator.rs:16:5: 16:8 (#0)};
- _3 = &mut _4;
-- _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}>::new(move _3) -> [return: bb2, unwind: bb5];
-- }
--
-- bb2: {
-+ _2 = Pin::<&mut {generator@$DIR/inline_generator.rs:16:5: 16:8}> { pointer: move _3 };
- StorageDead(_3);
-- _1 = <{generator@$DIR/inline_generator.rs:16:5: 16:8} as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb5];
-+ StorageLive(_5);
-+ _5 = const false;
-+ _6 = (_2.0: &mut {generator@$DIR/inline_generator.rs:16:5: 16:8});
-+ _7 = discriminant((*_6));
-+ switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11];
- }
-
-- bb3: {
-+ bb1: {
-+ StorageDead(_5);
- StorageDead(_2);
-- drop(_4) -> [return: bb4, unwind: bb6];
-+ drop(_4) -> [return: bb2, unwind: bb4];
- }
-
-- bb4: {
-+ bb2: {
- StorageDead(_4);
- _0 = const ();
- StorageDead(_1);
- return;
- }
-
-- bb5 (cleanup): {
-- drop(_4) -> [return: bb6, unwind terminate(cleanup)];
-+ bb3 (cleanup): {
-+ drop(_4) -> [return: bb4, unwind terminate(cleanup)];
- }
-
-- bb6 (cleanup): {
-+ bb4 (cleanup): {
- resume;
-+ }
-+
-+ bb5: {
-+ StorageLive(_8);
-+ switchInt(_5) -> [0: bb6, otherwise: bb7];
-+ }
-+
-+ bb6: {
-+ _8 = const 13_i32;
-+ goto -> bb8;
-+ }
-+
-+ bb7: {
-+ _8 = const 7_i32;
-+ goto -> bb8;
-+ }
-+
-+ bb8: {
-+ _1 = GeneratorState::<i32, bool>::Yielded(move _8);
-+ discriminant((*_6)) = 3;
-+ goto -> bb1;
-+ }
-+
-+ bb9: {
-+ assert(const false, "generator resumed after completion") -> [success: bb9, unwind: bb3];
-+ }
-+
-+ bb10: {
-+ StorageLive(_8);
-+ StorageDead(_8);
-+ _1 = GeneratorState::<i32, bool>::Complete(_5);
-+ discriminant((*_6)) = 1;
-+ goto -> bb1;
-+ }
-+
-+ bb11: {
-+ unreachable;
- }
- }
-
diff --git a/tests/mir-opt/inline/inline_generator.rs b/tests/mir-opt/inline/inline_generator.rs
deleted file mode 100644
index 2d71458c1..000000000
--- a/tests/mir-opt/inline/inline_generator.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// compile-flags: -Zinline-mir-hint-threshold=1000
-#![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]
-pub fn g() -> impl Generator<bool> {
- #[inline]
- |a| { yield if a { 7 } else { 13 } }
-}
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_into_box_place.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
index dc0ab255a..b90e0505c 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-abort.diff
@@ -122,9 +122,14 @@
+ _3 = const _;
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
+ StorageDead(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
+ _4 = SizeOf(std::vec::Vec<u32>);
+ _5 = AlignOf(std::vec::Vec<u32>);
+ StorageLive(_8);
++ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
@@ -178,10 +183,15 @@
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
++ StorageDead(_10);
+ StorageDead(_8);
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
+ (*_7) = move _2;
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];
diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
index 675292f06..f9c637caa 100644
--- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff
@@ -122,9 +122,14 @@
+ _3 = const _;
+ _2 = Vec::<u32> { buf: move _3, len: const 0_usize };
+ StorageDead(_3);
++ StorageLive(_4);
++ StorageLive(_5);
++ StorageLive(_6);
++ StorageLive(_7);
+ _4 = SizeOf(std::vec::Vec<u32>);
+ _5 = AlignOf(std::vec::Vec<u32>);
+ StorageLive(_8);
++ StorageLive(_10);
+ StorageLive(_11);
+ StorageLive(_12);
+ StorageLive(_13);
@@ -195,10 +200,15 @@
+ StorageDead(_13);
+ StorageDead(_12);
+ StorageDead(_11);
++ StorageDead(_10);
+ StorageDead(_8);
+ _1 = ShallowInitBox(move _6, std::vec::Vec<u32>);
+ _7 = (((_1.0: std::ptr::Unique<std::vec::Vec<u32>>).0: std::ptr::NonNull<std::vec::Vec<u32>>).0: *const std::vec::Vec<u32>);
+ (*_7) = move _2;
++ StorageDead(_7);
++ StorageDead(_6);
++ StorageDead(_5);
++ StorageDead(_4);
+ StorageDead(_2);
+ _0 = const ();
+ drop(_1) -> [return: bb1, unwind: bb2];
diff --git a/tests/mir-opt/inline/inline_into_box_place.rs b/tests/mir-opt/inline/inline_into_box_place.rs
index 56f174e51..65f8e2916 100644
--- a/tests/mir-opt/inline/inline_into_box_place.rs
+++ b/tests/mir-opt/inline/inline_into_box_place.rs
@@ -5,5 +5,7 @@
// EMIT_MIR inline_into_box_place.main.Inline.diff
fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: (inlined Box::<Vec<u32>>::new)
let _x: Box<Vec<u32>> = Box::new(Vec::new());
}
diff --git a/tests/mir-opt/inline/inline_options.rs b/tests/mir-opt/inline/inline_options.rs
index b247ecd0b..b940c64f0 100644
--- a/tests/mir-opt/inline/inline_options.rs
+++ b/tests/mir-opt/inline/inline_options.rs
@@ -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.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.rs b/tests/mir-opt/inline/inline_shims.rs
index eafbb962e..a223c2d26 100644
--- a/tests/mir-opt/inline/inline_shims.rs
+++ b/tests/mir-opt/inline/inline_shims.rs
@@ -3,11 +3,15 @@
// 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.rs b/tests/mir-opt/inline/inline_specialization.rs
index 0311531dc..6453abc00 100644
--- a/tests/mir-opt/inline/inline_specialization.rs
+++ b/tests/mir-opt/inline/inline_specialization.rs
@@ -3,6 +3,8 @@
// 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 a9d2168c2..b39355637 100644
--- a/tests/mir-opt/inline/inline_trait_method.rs
+++ b/tests/mir-opt/inline/inline_trait_method.rs
@@ -1,3 +1,4 @@
+// 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
@@ -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_2.rs b/tests/mir-opt/inline/inline_trait_method_2.rs
index 62ec7ebde..b0b6a7b9b 100644
--- a/tests/mir-opt/inline/inline_trait_method_2.rs
+++ b/tests/mir-opt/inline/inline_trait_method_2.rs
@@ -3,6 +3,9 @@
// 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/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
index 3d0c10725..688ab9c56 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff
@@ -18,6 +18,7 @@
bb0: {
- _0 = inner() -> [return: bb1, unwind unreachable];
+ StorageLive(_1);
++ StorageLive(_2);
+ _1 = const _;
+ _0 = index() -> [return: bb1, unwind unreachable];
}
@@ -40,6 +41,7 @@
+
+ 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
index 16a19f4a3..e4d2b1a7f 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff
@@ -18,6 +18,7 @@
bb0: {
- _0 = inner() -> [return: bb1, unwind continue];
+ StorageLive(_1);
++ StorageLive(_2);
+ _1 = const _;
+ _0 = index() -> [return: bb1, unwind continue];
}
@@ -40,6 +41,7 @@
+
+ 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 eed1d8917..592b4d9b7 100644
--- a/tests/mir-opt/inline/issue_106141.rs
+++ b/tests/mir-opt/inline/issue_106141.rs
@@ -1,14 +1,21 @@
+// 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.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir
index 6837da27a..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
@@ -17,9 +17,13 @@ fn b(_1: &mut Box<T>) -> &mut T {
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);
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 d09bfc33f..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
@@ -15,9 +15,13 @@ fn d(_1: &Box<T>) -> &T {
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);
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 4d170c41f..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
@@ -2,8 +2,8 @@
fn main() -> () {
let mut _0: ();
- let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
- let mut _2: &{closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
+ let _1: {closure@$DIR/issue_76997_inline_scopes_parenting.rs: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: ();
@@ -19,7 +19,7 @@ fn main() -> () {
bb0: {
StorageLive(_1);
- _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:5:13: 5:16};
+ _1 = {closure@$DIR/issue_76997_inline_scopes_parenting.rs:15:13: 15:16};
StorageLive(_2);
_2 = &_1;
StorageLive(_3);
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.panic-abort.diff b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
index bee01a5f9..b9f268df3 100644
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-abort.diff
@@ -8,31 +8,37 @@
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: {
+- _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: bb2, unwind unreachable];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind unreachable];
}
- bb2: {
+- bb2: {
++ bb1: {
StorageDead(_5);
StorageDead(_3);
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind unreachable];
+- drop(_1) -> [return: bb3, unwind unreachable];
++ drop(_1) -> [return: bb2, unwind unreachable];
}
- bb3: {
+- 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
index 5a946712e..8495164df 100644
--- a/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/issue_78442.bar.Inline.panic-unwind.diff
@@ -8,39 +8,48 @@
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: {
+- _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: bb2, unwind: bb4];
++ _2 = <fn() {foo} as Fn<()>>::call(move _3, move _5) -> [return: bb1, unwind: bb3];
}
- bb2: {
+- bb2: {
++ bb1: {
StorageDead(_5);
StorageDead(_3);
StorageDead(_4);
StorageDead(_2);
_0 = const ();
- drop(_1) -> [return: bb3, unwind: bb5];
+- drop(_1) -> [return: bb3, unwind: bb5];
++ drop(_1) -> [return: bb2, unwind: bb4];
}
- bb3: {
+- bb3: {
++ bb2: {
return;
}
- bb4 (cleanup): {
- drop(_1) -> [return: bb5, unwind terminate(cleanup)];
+- bb4 (cleanup): {
+- drop(_1) -> [return: bb5, unwind terminate(cleanup)];
++ bb3 (cleanup): {
++ drop(_1) -> [return: bb4, unwind terminate(cleanup)];
}
- bb5 (cleanup): {
+- bb5 (cleanup): {
++ bb4 (cleanup): {
resume;
}
}
diff --git a/tests/mir-opt/inline/issue_78442.rs b/tests/mir-opt/inline/issue_78442.rs
index d956e6241..f9a523428 100644
--- a/tests/mir-opt/inline/issue_78442.rs
+++ b/tests/mir-opt/inline/issue_78442.rs
@@ -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 22f84e44a..0de80641c 100644
--- a/tests/mir-opt/inline/unchecked_shifts.rs
+++ b/tests/mir-opt/inline/unchecked_shifts.rs
@@ -1,6 +1,6 @@
// 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,23 +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/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 ab81f7071..37083973f 100644
--- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -6,24 +6,18 @@
let mut _0: ();
let _2: ();
let mut _3: std::boxed::Box<[i32]>;
- let mut _4: &mut std::boxed::Box<[i32]>;
- let mut _5: ();
- let mut _6: &mut std::boxed::Box<[i32]>;
- let mut _7: ();
- let mut _8: &mut std::boxed::Box<[i32]>;
- let mut _9: ();
- let mut _10: *const [i32];
+ let mut _4: *const [i32];
bb0: {
StorageLive(_2);
StorageLive(_3);
_3 = move _1;
- _10 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]);
- _2 = callee(move (*_10)) -> [return: bb3, unwind: bb4];
+ _4 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]);
+ _2 = callee(move (*_4)) -> [return: bb1, unwind: bb3];
}
- bb1 (cleanup): {
- resume;
+ bb1: {
+ drop(_3) -> [return: bb2, unwind: bb4];
}
bb2: {
@@ -33,14 +27,12 @@
return;
}
- bb3: {
- _4 = &mut _3;
- _5 = <Box<[i32]> as Drop>::drop(move _4) -> [return: bb2, unwind: bb1];
+ bb3 (cleanup): {
+ drop(_3) -> [return: bb4, unwind terminate(cleanup)];
}
bb4 (cleanup): {
- _8 = &mut _3;
- _9 = <Box<[i32]> as Drop>::drop(move _8) -> [return: bb1, unwind terminate(cleanup)];
+ 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 f28aef7a8..be133706e 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.rs
+++ b/tests/mir-opt/inline/unwrap_unchecked.rs
@@ -7,5 +7,7 @@
// 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.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff
index e3c573473..2a36ad923 100644
--- 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
@@ -9,6 +9,7 @@
+ debug self => _2;
+ let mut _3: &std::option::Option<T>;
+ let mut _4: isize;
++ let mut _5: bool;
+ scope 2 {
+ debug val => _0;
+ }
@@ -29,17 +30,18 @@
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);
-+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
- }
-
- bb1: {
-+ unreachable;
-+ }
-+
-+ bb2: {
++ _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
index fc638cb3a..14c8c671d 100644
--- 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
@@ -9,6 +9,7 @@
+ debug self => _2;
+ let mut _3: &std::option::Option<T>;
+ let mut _4: isize;
++ let mut _5: bool;
+ scope 2 {
+ debug val => _0;
+ }
@@ -29,24 +30,25 @@
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);
-+ switchInt(move _4) -> [1: bb2, otherwise: bb1];
- }
-
- bb1: {
-- StorageDead(_2);
-- return;
-+ unreachable;
- }
-
-- bb2 (cleanup): {
-- resume;
-+ bb2: {
++ _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;
+ StorageDead(_2);
+ return;
+- }
+-
+- bb2 (cleanup): {
+- resume;
}
}
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
index fcc4d43ce..aeb93bd33 100644
--- 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
@@ -6,7 +6,8 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
debug self => _1;
let mut _2: isize;
- let mut _3: &std::option::Option<T>;
+ let mut _3: bool;
+ let mut _4: &std::option::Option<T>;
scope 2 {
debug val => _0;
}
@@ -19,23 +20,21 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
}
}
scope 4 (inlined Option::<T>::is_some) {
- debug self => _3;
+ debug self => _4;
}
}
bb0: {
+ StorageLive(_4);
+ StorageLive(_2);
StorageLive(_3);
_2 = discriminant(_1);
- switchInt(move _2) -> [1: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 1_isize);
+ assume(move _3);
_0 = move ((_1 as Some).0: T);
StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_4);
return;
}
-
- bb2: {
- unreachable;
- }
}
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
index fcc4d43ce..aeb93bd33 100644
--- 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
@@ -6,7 +6,8 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) {
debug self => _1;
let mut _2: isize;
- let mut _3: &std::option::Option<T>;
+ let mut _3: bool;
+ let mut _4: &std::option::Option<T>;
scope 2 {
debug val => _0;
}
@@ -19,23 +20,21 @@ fn unwrap_unchecked(_1: Option<T>) -> T {
}
}
scope 4 (inlined Option::<T>::is_some) {
- debug self => _3;
+ debug self => _4;
}
}
bb0: {
+ StorageLive(_4);
+ StorageLive(_2);
StorageLive(_3);
_2 = discriminant(_1);
- switchInt(move _2) -> [1: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 1_isize);
+ assume(move _3);
_0 = move ((_1 as Some).0: T);
StorageDead(_3);
+ StorageDead(_2);
+ StorageDead(_4);
return;
}
-
- bb2: {
- unreachable;
- }
}
diff --git a/tests/mir-opt/inline_generically_if_sized.rs b/tests/mir-opt/inline_generically_if_sized.rs
index 1acfff7a5..1a7512a4b 100644
--- a/tests/mir-opt/inline_generically_if_sized.rs
+++ b/tests/mir-opt/inline_generically_if_sized.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: Inline
// compile-flags: --crate-type=lib -C panic=abort
diff --git a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
index afcfde09c..1ef6b69ef 100644
--- a/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
+++ b/tests/mir-opt/instrument_coverage.bar.InstrumentCoverage.diff
@@ -4,8 +4,10 @@
fn bar() -> bool {
let mut _0: bool;
++ coverage Counter(0) => /the/src/instrument_coverage.rs:21:1 - 23:2;
++
bb0: {
-+ Coverage::Counter(0) for /the/src/instrument_coverage.rs:20:1 - 22: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 e17c6ddc5..14b4833a5 100644
--- a/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
+++ b/tests/mir-opt/instrument_coverage.main.InstrumentCoverage.diff
@@ -7,13 +7,21 @@
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(0) for /the/src/instrument_coverage.rs:11:1 - 11:11;
++ Coverage::CounterIncrement(0);
goto -> bb1;
}
bb1: {
-+ Coverage::Expression(0) = Counter(0) + Counter(1) for /the/src/instrument_coverage.rs:12:5 - 13:17;
++ Coverage::ExpressionUsed(0);
falseUnwind -> [real: bb2, unwind: bb6];
}
@@ -27,15 +35,14 @@
}
bb4: {
-+ Coverage::Expression(2) = Expression(1) + Zero for /the/src/instrument_coverage.rs:17:1 - 17:2;
-+ Coverage::Expression(1) = Expression(0) - Counter(1) for /the/src/instrument_coverage.rs:14:13 - 14:18;
++ Coverage::ExpressionUsed(1);
_0 = const ();
StorageDead(_2);
return;
}
bb5: {
-+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:15:10 - 15:11;
++ Coverage::CounterIncrement(1);
_1 = const ();
StorageDead(_2);
goto -> bb1;
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/combine_array_len.norm2.InstSimplify.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff
index 3e7d0ce51..3e7d0ce51 100644
--- a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-abort.diff
+++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff
diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff
index 4833c1089..4833c1089 100644
--- a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff
+++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff
diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/instsimplify/combine_array_len.rs
index e971ab478..3b6795bc9 100644
--- a/tests/mir-opt/combine_array_len.rs
+++ b/tests/mir-opt/instsimplify/combine_array_len.rs
@@ -1,8 +1,10 @@
// 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/instsimplify/combine_clone_of_primitives.rs b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs
new file mode 100644
index 000000000..2adbe778d
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.rs
@@ -0,0 +1,24 @@
+// unit-test: InstSimplify
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
+#[derive(Clone)]
+struct MyThing<T> {
+ v: T,
+ i: u64,
+ 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();
+
+ assert_eq!(y.v, 2);
+ assert_eq!(y.i, 3);
+ assert_eq!(y.a, [0.0; 3]);
+}
diff --git a/tests/mir-opt/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
index 124c2dc7e..48586f8b3 100644
--- a/tests/mir-opt/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
@@ -1,7 +1,7 @@
-- // 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
+- // 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:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
+ 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;
diff --git a/tests/mir-opt/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
index f2b87221f..a57266e9c 100644
--- a/tests/mir-opt/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
@@ -1,7 +1,7 @@
-- // 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
+- // 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:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
+ 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;
diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff
index cb623e83f..cb623e83f 100644
--- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff
diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff
index 58ae59190..58ae59190 100644
--- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff
diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff
index 8eff802dd..8eff802dd 100644
--- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs
new file mode 100644
index 000000000..b8e15da90
--- /dev/null
+++ b/tests/mir-opt/instsimplify/combine_transmutes.rs
@@ -0,0 +1,65 @@
+// unit-test: InstSimplify
+// compile-flags: -C panic=abort
+
+#![crate_type = "lib"]
+#![feature(core_intrinsics)]
+#![feature(custom_mir)]
+
+use std::intrinsics::mir::*;
+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());
+}
+
+#[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
+ let B = CastTransmute::<i32, i64>(1); // UB
+ let C = CastTransmute::<u64, i64>(1); // Can be a cast
+ let D = CastTransmute::<u64, u32>(1); // UB
+ let E = CastTransmute::<isize, usize>(1); // Can be a cast
+ Return()
+ }
+ }
+}
+
+// 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));
+ let _a: u32 = transmute(Union32 { i32: 0 });
+ let _a: i32 = transmute(Union32 { u32: 0 });
+ let _a: ManuallyDrop<String> = transmute(MaybeUninit::<String>::uninit());
+}
+
+pub union Union32 { u32: u32, i32: i32 }
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
index e2b45c882..e2b45c882 100644
--- a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify.diff
diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.rs b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs
new file mode 100644
index 000000000..e40bc7eda
--- /dev/null
+++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.rs
@@ -0,0 +1,29 @@
+// unit-test: InstSimplify
+
+#![feature(custom_mir, core_intrinsics)]
+#![crate_type = "lib"]
+
+use std::intrinsics::mir::*;
+
+// 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 {
+ 0 => retblock,
+ 1 => unreachable,
+ _ => unreachable,
+ }
+ }
+ unreachable = {
+ Unreachable()
+ }
+ retblock = {
+ RET = x;
+ Return()
+ }
+ )
+}
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/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff
index 46e053378..1be386acf 100644
--- a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.panics.InstSimplify.diff
@@ -8,28 +8,28 @@
let _3: ();
bb0: {
- nop;
+ StorageLive(_1);
- _1 = assert_inhabited::<Never>() -> [return: bb1, unwind unreachable];
+ _1 = assert_inhabited::<Never>() -> unwind unreachable;
}
bb1: {
- nop;
- nop;
+ StorageDead(_1);
+ StorageLive(_2);
- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable];
+ _2 = assert_zero_valid::<&u8>() -> unwind unreachable;
}
bb2: {
- nop;
- nop;
+ StorageDead(_2);
+ StorageLive(_3);
- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable];
+ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable;
}
bb3: {
- nop;
- nop;
+ StorageDead(_3);
+ _0 = const ();
return;
}
}
diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff
index 70c3e8830..f2e697838 100644
--- a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.removable.InstSimplify.diff
@@ -8,28 +8,28 @@
let _3: ();
bb0: {
- nop;
+ StorageLive(_1);
- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable];
+ goto -> bb1;
}
bb1: {
- nop;
- nop;
+ StorageDead(_1);
+ StorageLive(_2);
- _2 = assert_zero_valid::<u8>() -> [return: bb2, unwind unreachable];
+ goto -> bb2;
}
bb2: {
- nop;
- nop;
+ StorageDead(_2);
+ StorageLive(_3);
- _3 = assert_mem_uninitialized_valid::<u8>() -> [return: bb3, unwind unreachable];
+ goto -> bb3;
}
bb3: {
- nop;
- nop;
+ StorageDead(_3);
+ _0 = const ();
return;
}
}
diff --git a/tests/mir-opt/instsimplify/intrinsic_asserts.rs b/tests/mir-opt/instsimplify/intrinsic_asserts.rs
new file mode 100644
index 000000000..43998b2db
--- /dev/null
+++ b/tests/mir-opt/instsimplify/intrinsic_asserts.rs
@@ -0,0 +1,50 @@
+// 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>();
+}
+
+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>();
+}
+
+// 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.rs b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs
deleted file mode 100644
index 3e280a40f..000000000
--- a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-#![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
-#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
-pub unsafe fn assert_zero(x: u8) -> u8 {
- mir!(
- {
- match x {
- 0 => retblock,
- 1 => unreachable,
- _ => unreachable,
- }
- }
- unreachable = {
- Unreachable()
- }
- retblock = {
- RET = x;
- Return()
- }
- )
-}
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 efa52798e..000000000
--- a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-- // MIR for `generic` before InstSimplify
-+ // MIR for `generic` after InstSimplify
-
- fn generic() -> () {
- let mut _0: ();
- let _1: ();
- let _2: ();
- let _3: ();
-
- bb0: {
- nop;
- _1 = assert_inhabited::<T>() -> [return: bb1, unwind unreachable];
- }
-
- bb1: {
- nop;
- nop;
- _2 = assert_zero_valid::<T>() -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
- nop;
- nop;
- _3 = assert_mem_uninitialized_valid::<T>() -> [return: bb3, unwind unreachable];
- }
-
- bb3: {
- nop;
- nop;
- return;
- }
- }
-
diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/intrinsic_asserts.rs
deleted file mode 100644
index 302d4bda1..000000000
--- a/tests/mir-opt/intrinsic_asserts.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#![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() {
- core::intrinsics::assert_inhabited::<()>();
- core::intrinsics::assert_zero_valid::<u8>();
- core::intrinsics::assert_mem_uninitialized_valid::<u8>();
-}
-
-enum Never {}
-
-// These assertions all diverge, so their target blocks should become None.
-// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff
-pub fn panics() {
- core::intrinsics::assert_inhabited::<Never>();
- core::intrinsics::assert_zero_valid::<&u8>();
- core::intrinsics::assert_mem_uninitialized_valid::<&u8>();
-}
-
-// 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>() {
- core::intrinsics::assert_inhabited::<T>();
- core::intrinsics::assert_zero_valid::<T>();
- core::intrinsics::assert_mem_uninitialized_valid::<T>();
-}
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
index ce490e894..3748d1483 100644
--- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
+++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff
@@ -33,6 +33,7 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
+ _4 = const 0_u32;
StorageLive(_15);
StorageLive(_14);
_14 = Shr(_1, const 0_i32);
diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
index 254557b99..9dab4233c 100644
--- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
+++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff
@@ -33,6 +33,7 @@
StorageLive(_2);
StorageLive(_3);
StorageLive(_4);
+ _4 = const 0_u32;
StorageLive(_15);
StorageLive(_14);
_14 = Shr(_1, const 0_i32);
diff --git a/tests/mir-opt/issue_101973.rs b/tests/mir-opt/issue_101973.rs
index 01b342f4d..3de325bc1 100644
--- a/tests/mir-opt/issue_101973.rs
+++ b/tests/mir-opt/issue_101973.rs
@@ -1,3 +1,4 @@
+// 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.rs b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
index 54112627e..cd068f122 100644
--- a/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
+++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Check that `UnwindAction::Unreachable` is not generated for unwindable intrinsics.
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#![feature(core_intrinsics)]
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.rs b/tests/mir-opt/issue_41110.rs
index d8665b23d..38602d5ea 100644
--- a/tests/mir-opt/issue_41110.rs
+++ b/tests/mir-opt/issue_41110.rs
@@ -1,3 +1,4 @@
+// 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_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 0b48e58da..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,6 +1,6 @@
-// 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 = {
+<impl at $DIR/issue_41697.rs:19:1: 19:23>::{constant#0}: usize = {
let mut _0: usize;
let mut _1: (usize, bool);
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
index b57fe348c..55d2629a5 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff
@@ -10,9 +10,8 @@
let mut _5: isize;
+ let mut _7: bool;
+ let mut _8: bool;
-+ let mut _9: bool;
++ let mut _9: isize;
+ let mut _10: isize;
-+ let mut _11: isize;
scope 1 {
debug e => _1;
scope 2 {
@@ -24,7 +23,6 @@
bb0: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageLive(_1);
StorageLive(_2);
_2 = cond() -> [return: bb1, unwind: bb11];
@@ -47,7 +45,6 @@
bb3: {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb5, unwind: bb11];
+ goto -> bb5;
@@ -56,7 +53,6 @@
bb4 (cleanup): {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
@@ -64,13 +60,13 @@
bb5: {
StorageDead(_3);
+ PlaceMention(_1);
_5 = discriminant(_1);
switchInt(move _5) -> [0: bb6, otherwise: bb7];
}
bb6: {
StorageLive(_6);
-+ _9 = const false;
_6 = move ((_1 as F).0: K);
_0 = const ();
StorageDead(_6);
@@ -90,13 +86,12 @@
bb9: {
StorageDead(_2);
- drop(_1) -> [return: bb10, unwind: bb12];
-+ goto -> bb18;
++ goto -> bb19;
}
bb10: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageDead(_1);
return;
}
@@ -116,33 +111,37 @@
+ }
+
+ bb14 (cleanup): {
-+ goto -> bb12;
++ drop(((_1 as F).0: K)) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
-+ bb15: {
-+ drop(_1) -> [return: bb13, unwind: bb12];
++ bb15 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb14];
+ }
+
-+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ bb16: {
++ drop(_1) -> [return: bb13, unwind: bb12];
+ }
+
-+ bb17: {
-+ _10 = discriminant(_1);
-+ switchInt(move _10) -> [0: bb13, otherwise: bb15];
++ bb17 (cleanup): {
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb18: {
-+ switchInt(_7) -> [0: bb13, otherwise: bb17];
++ _9 = discriminant(_1);
++ switchInt(move _9) -> [0: bb13, otherwise: bb16];
+ }
+
-+ bb19 (cleanup): {
-+ _11 = discriminant(_1);
-+ switchInt(move _11) -> [0: bb14, otherwise: bb16];
++ bb19: {
++ switchInt(_7) -> [0: bb13, otherwise: bb18];
+ }
+
+ bb20 (cleanup): {
-+ switchInt(_7) -> [0: bb12, otherwise: bb19];
++ _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
index 2156850e3..c731b5646 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff
@@ -10,9 +10,8 @@
let mut _5: isize;
+ let mut _7: bool;
+ let mut _8: bool;
-+ let mut _9: bool;
++ let mut _9: isize;
+ let mut _10: isize;
-+ let mut _11: isize;
scope 1 {
debug e => _1;
scope 2 {
@@ -24,7 +23,6 @@
bb0: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageLive(_1);
StorageLive(_2);
_2 = cond() -> [return: bb1, unwind: bb11];
@@ -47,7 +45,6 @@
bb3: {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb5, unwind: bb11];
+ goto -> bb5;
@@ -56,7 +53,6 @@
bb4 (cleanup): {
+ _7 = const true;
+ _8 = const true;
-+ _9 = const true;
_1 = move _3;
- drop(_3) -> [return: bb11, unwind terminate(cleanup)];
+ goto -> bb11;
@@ -64,13 +60,13 @@
bb5: {
StorageDead(_3);
+ PlaceMention(_1);
_5 = discriminant(_1);
switchInt(move _5) -> [0: bb6, otherwise: bb7];
}
bb6: {
StorageLive(_6);
-+ _9 = const false;
_6 = move ((_1 as F).0: K);
_0 = const ();
StorageDead(_6);
@@ -90,13 +86,12 @@
bb9: {
StorageDead(_2);
- drop(_1) -> [return: bb10, unwind continue];
-+ goto -> bb18;
++ goto -> bb19;
}
bb10: {
+ _7 = const false;
+ _8 = const false;
-+ _9 = const false;
StorageDead(_1);
return;
}
@@ -116,33 +111,37 @@
+ }
+
+ bb14 (cleanup): {
-+ goto -> bb12;
++ drop(((_1 as F).0: K)) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
-+ bb15: {
-+ drop(_1) -> [return: bb13, unwind: bb12];
++ bb15 (cleanup): {
++ switchInt(_7) -> [0: bb12, otherwise: bb14];
+ }
+
-+ bb16 (cleanup): {
-+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
++ bb16: {
++ drop(_1) -> [return: bb13, unwind: bb12];
+ }
+
-+ bb17: {
-+ _10 = discriminant(_1);
-+ switchInt(move _10) -> [0: bb13, otherwise: bb15];
++ bb17 (cleanup): {
++ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
+ }
+
+ bb18: {
-+ switchInt(_7) -> [0: bb13, otherwise: bb17];
++ _9 = discriminant(_1);
++ switchInt(move _9) -> [0: bb13, otherwise: bb16];
+ }
+
-+ bb19 (cleanup): {
-+ _11 = discriminant(_1);
-+ switchInt(move _11) -> [0: bb14, otherwise: bb16];
++ bb19: {
++ switchInt(_7) -> [0: bb13, otherwise: bb18];
+ }
+
+ bb20 (cleanup): {
-+ switchInt(_7) -> [0: bb12, otherwise: bb19];
++ _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 9b16caf92..70b202186 100644
--- a/tests/mir-opt/issue_41888.rs
+++ b/tests/mir-opt/issue_41888.rs
@@ -1,3 +1,4 @@
+// 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 fece6bb7c..40e8352cf 100644
--- a/tests/mir-opt/issue_62289.rs
+++ b/tests/mir-opt/issue_62289.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// check that we don't forget to drop the Box if we early return before
// initializing it
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
index 734629678..fadfdfc87 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir
@@ -45,6 +45,7 @@ fn test() -> Option<Box<u32>> {
bb2: {
StorageDead(_7);
+ PlaceMention(_6);
_8 = discriminant(_6);
switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
}
diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
index 8264e2cab..8f94165a1 100644
--- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
+++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir
@@ -45,6 +45,7 @@ fn test() -> Option<Box<u32>> {
bb2: {
StorageDead(_7);
+ PlaceMention(_6);
_8 = discriminant(_6);
switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4];
}
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 16f34e4a4..89da9a801 100644
--- a/tests/mir-opt/issue_72181_1.f.built.after.mir
+++ b/tests/mir-opt/issue_72181_1.f.built.after.mir
@@ -5,6 +5,7 @@ fn f(_1: Void) -> ! {
let mut _0: !;
bb0: {
+ PlaceMention(_1);
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
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 f5ab5b526..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,8 +1,8 @@
// 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: ();
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 2a8e1283b..f0f12c535 100644
--- a/tests/mir-opt/issue_76432.rs
+++ b/tests/mir-opt/issue_76432.rs
@@ -1,3 +1,4 @@
+// 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.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
index 9d8f272ab..b2539f391 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff
@@ -7,22 +7,18 @@
let _2: &[T];
let mut _3: &[T; 3];
let _4: [T; 3];
- let mut _5: T;
- let mut _6: T;
- let mut _7: T;
- let mut _8: usize;
- let mut _9: usize;
- let mut _10: bool;
- let mut _14: !;
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _10: !;
scope 1 {
debug v => _2;
- let _11: &T;
- let _12: &T;
- let _13: &T;
+ let _7: &T;
+ let _8: &T;
+ let _9: &T;
scope 2 {
- debug v1 => _11;
- debug v2 => _12;
- debug v3 => _13;
+ debug v1 => _7;
+ debug v2 => _8;
+ debug v3 => _9;
}
}
@@ -33,26 +29,25 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = const 3_usize;
- _9 = const 3_usize;
- _10 = const true;
+ _5 = const 3_usize;
+ _6 = const true;
goto -> bb2;
}
bb1: {
- _14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
+ _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable;
}
bb2: {
- StorageLive(_11);
- _11 = &(*_2)[0 of 3];
- StorageLive(_12);
- _12 = &(*_2)[1 of 3];
- StorageLive(_13);
- _13 = &(*_2)[2 of 3];
- StorageDead(_13);
- StorageDead(_12);
- StorageDead(_11);
+ 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
index 738b0b1b3..ff7f12c09 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff
@@ -7,22 +7,18 @@
let _2: &[T];
let mut _3: &[T; 3];
let _4: [T; 3];
- let mut _5: T;
- let mut _6: T;
- let mut _7: T;
- let mut _8: usize;
- let mut _9: usize;
- let mut _10: bool;
- let mut _14: !;
+ let mut _5: usize;
+ let mut _6: bool;
+ let mut _10: !;
scope 1 {
debug v => _2;
- let _11: &T;
- let _12: &T;
- let _13: &T;
+ let _7: &T;
+ let _8: &T;
+ let _9: &T;
scope 2 {
- debug v1 => _11;
- debug v2 => _12;
- debug v3 => _13;
+ debug v1 => _7;
+ debug v2 => _8;
+ debug v3 => _9;
}
}
@@ -33,26 +29,25 @@
_3 = &_4;
_2 = move _3 as &[T] (PointerCoercion(Unsize));
StorageDead(_3);
- _8 = const 3_usize;
- _9 = const 3_usize;
- _10 = const true;
+ _5 = const 3_usize;
+ _6 = const true;
goto -> bb2;
}
bb1: {
- _14 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
+ _10 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue;
}
bb2: {
- StorageLive(_11);
- _11 = &(*_2)[0 of 3];
- StorageLive(_12);
- _12 = &(*_2)[1 of 3];
- StorageLive(_13);
- _13 = &(*_2)[2 of 3];
- StorageDead(_13);
- StorageDead(_12);
- StorageDead(_11);
+ 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.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.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
index 132b71335..ffb1aedd2 100644
--- a/tests/mir-opt/issue_99325.main.built.after.32bit.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 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: ();
@@ -81,7 +81,7 @@ fn main() -> () {
_2 = (move _3, move _5);
StorageDead(_5);
StorageDead(_3);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
StorageLive(_8);
_8 = (_2.0: &&[u8]);
StorageLive(_9);
@@ -180,7 +180,7 @@ fn main() -> () {
_23 = (move _24, move _26);
StorageDead(_26);
StorageDead(_24);
- FakeRead(ForMatchedPlace(None), _23);
+ PlaceMention(_23);
StorageLive(_28);
_28 = (_23.0: &&[u8]);
StorageLive(_29);
@@ -271,6 +271,6 @@ fn main() -> () {
}
}
-alloc4 (size: 4, align: 1) {
+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
index 132b71335..ffb1aedd2 100644
--- a/tests/mir-opt/issue_99325.main.built.after.64bit.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir
@@ -1,8 +1,8 @@
// MIR for `main` after built
| User Type Annotations
-| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [&*b"AAAA"], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:12:16: 12:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] }: &ReStatic [u8; 4_usize]], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:13:16: 13:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 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: ();
@@ -81,7 +81,7 @@ fn main() -> () {
_2 = (move _3, move _5);
StorageDead(_5);
StorageDead(_3);
- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
StorageLive(_8);
_8 = (_2.0: &&[u8]);
StorageLive(_9);
@@ -180,7 +180,7 @@ fn main() -> () {
_23 = (move _24, move _26);
StorageDead(_26);
StorageDead(_24);
- FakeRead(ForMatchedPlace(None), _23);
+ PlaceMention(_23);
StorageLive(_28);
_28 = (_23.0: &&[u8]);
StorageLive(_29);
@@ -271,6 +271,6 @@ fn main() -> () {
}
}
-alloc4 (size: 4, align: 1) {
+ALLOC0 (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 3603228a5..2638b69e2 100644
--- a/tests/mir-opt/issue_99325.rs
+++ b/tests/mir-opt/issue_99325.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_BIT_WIDTH
#![feature(adt_const_params)]
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
index f8c859418..5d25c6557 100644
--- 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
@@ -3,56 +3,61 @@
fn num_to_digit(_1: char) -> u32 {
debug num => _1;
let mut _0: u32;
- let mut _4: std::option::Option<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 _7: &std::option::Option<u32>;
+ let mut _3: &std::option::Option<u32>;
scope 2 (inlined Option::<u32>::is_some) {
- debug self => _7;
- let mut _3: isize;
+ debug self => _3;
+ let mut _4: isize;
}
}
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
- debug self => _4;
- let mut _5: isize;
- let mut _6: !;
+ debug self => _5;
+ let mut _6: isize;
+ let mut _7: !;
scope 4 {
debug val => _0;
}
}
bb0: {
- StorageLive(_7);
+ StorageLive(_3);
StorageLive(_2);
_2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable];
}
bb1: {
- _3 = discriminant(_2);
- StorageDead(_7);
+ _3 = &_2;
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ StorageDead(_3);
StorageDead(_2);
- switchInt(move _3) -> [1: bb2, otherwise: bb7];
+ switchInt(move _4) -> [1: bb2, otherwise: bb7];
}
bb2: {
- StorageLive(_4);
- _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind unreachable];
}
bb3: {
- _5 = discriminant(_4);
- switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
+ StorageLive(_6);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6];
}
bb4: {
- _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
}
bb5: {
- _0 = move ((_4 as Some).0: u32);
- StorageDead(_4);
+ _0 = move ((_5 as Some).0: u32);
+ StorageDead(_6);
+ StorageDead(_5);
goto -> bb8;
}
@@ -61,6 +66,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb7: {
+ StorageDead(_4);
_0 = const 0_u32;
goto -> bb8;
}
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
index df7392edc..4677c0108 100644
--- 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
@@ -3,56 +3,61 @@
fn num_to_digit(_1: char) -> u32 {
debug num => _1;
let mut _0: u32;
- let mut _4: std::option::Option<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 _7: &std::option::Option<u32>;
+ let mut _3: &std::option::Option<u32>;
scope 2 (inlined Option::<u32>::is_some) {
- debug self => _7;
- let mut _3: isize;
+ debug self => _3;
+ let mut _4: isize;
}
}
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) {
- debug self => _4;
- let mut _5: isize;
- let mut _6: !;
+ debug self => _5;
+ let mut _6: isize;
+ let mut _7: !;
scope 4 {
debug val => _0;
}
}
bb0: {
- StorageLive(_7);
+ StorageLive(_3);
StorageLive(_2);
_2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue];
}
bb1: {
- _3 = discriminant(_2);
- StorageDead(_7);
+ _3 = &_2;
+ StorageLive(_4);
+ _4 = discriminant(_2);
+ StorageDead(_3);
StorageDead(_2);
- switchInt(move _3) -> [1: bb2, otherwise: bb7];
+ switchInt(move _4) -> [1: bb2, otherwise: bb7];
}
bb2: {
- StorageLive(_4);
- _4 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
+ StorageDead(_4);
+ StorageLive(_5);
+ _5 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> [return: bb3, unwind continue];
}
bb3: {
- _5 = discriminant(_4);
- switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6];
+ StorageLive(_6);
+ _6 = discriminant(_5);
+ switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6];
}
bb4: {
- _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
}
bb5: {
- _0 = move ((_4 as Some).0: u32);
- StorageDead(_4);
+ _0 = move ((_5 as Some).0: u32);
+ StorageDead(_6);
+ StorageDead(_5);
goto -> bb8;
}
@@ -61,6 +66,7 @@ fn num_to_digit(_1: char) -> u32 {
}
bb7: {
+ StorageDead(_4);
_0 = const 0_u32;
goto -> bb8;
}
diff --git a/tests/mir-opt/issues/issue_59352.rs b/tests/mir-opt/issues/issue_59352.rs
index 7cadf8f22..1cbeaec28 100644
--- a/tests/mir-opt/issues/issue_59352.rs
+++ b/tests/mir-opt/issues/issue_59352.rs
@@ -1,3 +1,4 @@
+// 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
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..f17c9ba3f
--- /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: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_4);
+ _5 = discriminant(_3);
+- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_9);
+ _9 = ((_3 as Continue).0: i32);
+ _2 = _9;
+ StorageDead(_9);
+ _0 = Result::<i32, i32>::Ok(move _2);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb5;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ 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 -> bb5;
+ }
+
+ bb5: {
+ return;
+ }
+
+ 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 -> bb1;
++ goto -> bb9;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8: {
+ _11 = move ((_4 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11);
+ goto -> bb1;
++ }
++
++ bb9: {
++ StorageDead(_12);
++ StorageDead(_11);
++ StorageDead(_10);
++ StorageDead(_4);
++ _5 = discriminant(_3);
++ goto -> bb4;
+ }
+ }
+
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..f17c9ba3f
--- /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: {
+ StorageDead(_12);
+ StorageDead(_11);
+ StorageDead(_10);
+ StorageDead(_4);
+ _5 = discriminant(_3);
+- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
++ goto -> bb2;
+ }
+
+ bb2: {
+ StorageLive(_9);
+ _9 = ((_3 as Continue).0: i32);
+ _2 = _9;
+ StorageDead(_9);
+ _0 = Result::<i32, i32>::Ok(move _2);
+ StorageDead(_2);
+ StorageDead(_3);
+ goto -> bb5;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+ 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 -> bb5;
+ }
+
+ bb5: {
+ return;
+ }
+
+ 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 -> bb1;
++ goto -> bb9;
+ }
+
+ bb7: {
+ unreachable;
+ }
+
+ bb8: {
+ _11 = move ((_4 as Ok).0: i32);
+ _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _11);
+ goto -> bb1;
++ }
++
++ bb9: {
++ StorageDead(_12);
++ StorageDead(_11);
++ StorageDead(_10);
++ StorageDead(_4);
++ _5 = discriminant(_3);
++ goto -> bb4;
+ }
+ }
+
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..852dcd0db
--- /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: goto -> bb2;
+ // CHECK: bb2: {
+ // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32);
+ // CHECK: _0 = Result::<i32, i32>::Ok(
+ // CHECK: goto -> bb5;
+ // CHECK: bb3: {
+ // CHECK: unreachable;
+ // CHECK: bb4: {
+ // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>);
+ // CHECK: _0 = Result::<i32, i32>::Err(
+ // CHECK: goto -> bb5;
+ // CHECK: bb5: {
+ // CHECK: return;
+ // 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 -> bb1;
+ // CHECK: bb9: {
+ // CHECK: goto -> bb4;
+ 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.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.rs b/tests/mir-opt/lower_array_len.rs
index 7d69e1759..effd83b6a 100644
--- a/tests/mir-opt/lower_array_len.rs
+++ b/tests/mir-opt/lower_array_len.rs
@@ -4,6 +4,9 @@
// 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.rs b/tests/mir-opt/lower_intrinsics.rs
index 0758e9b77..913605cc2 100644
--- a/tests/mir-opt/lower_intrinsics.rs
+++ b/tests/mir-opt/lower_intrinsics.rs
@@ -6,6 +6,10 @@
// 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);
@@ -13,6 +17,14 @@ pub fn wrapping(a: i32, b: i32) {
// 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);
@@ -24,26 +36,39 @@ pub unsafe fn unchecked(a: i32, b: i32) {
// 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()
@@ -51,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 {}
}
@@ -90,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(&());
@@ -104,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 {
@@ -113,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);
}
@@ -120,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);
@@ -127,16 +191,32 @@ 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) }
}
@@ -144,6 +224,10 @@ pub enum Never {}
// EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff
pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
+ // CHECK-LABEL: fn option_payload(
+ // CHECK: {{_.*}} = &raw const (((*{{_.*}}) as Some).0: usize);
+ // CHECK: {{_.*}} = &raw const (((*{{_.*}}) as Some).0: std::string::String);
+
unsafe {
let _x = core::intrinsics::option_payload_ptr(o);
let _y = core::intrinsics::option_payload_ptr(p);
@@ -152,5 +236,8 @@ pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
// 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.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff
index 49cc8b1af..c4a3358ff 100644
--- 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
@@ -4,6 +4,7 @@
fn transmute_to_box_uninhabited() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -16,6 +17,8 @@
}
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
index 49cc8b1af..c4a3358ff 100644
--- 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
@@ -4,6 +4,7 @@
fn transmute_to_box_uninhabited() -> ! {
let mut _0: !;
let _1: std::boxed::Box<Never>;
+ let mut _2: *const Never;
scope 1 {
debug x => _1;
}
@@ -16,6 +17,8 @@
}
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.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff
index 94c7ebe15..c2c4ec000 100644
--- 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
@@ -16,6 +16,7 @@
}
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
index 94c7ebe15..c2c4ec000 100644
--- 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
@@ -16,6 +16,7 @@
}
bb1: {
+ PlaceMention((*_1));
unreachable;
}
}
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
index 6576616e0..1b516a1f5 100644
--- 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
@@ -16,6 +16,7 @@
}
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
index 6576616e0..1b516a1f5 100644
--- 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
@@ -16,6 +16,7 @@
}
bb1: {
+ PlaceMention((*_1));
unreachable;
}
}
diff --git a/tests/mir-opt/lower_slice_len.rs b/tests/mir-opt/lower_slice_len.rs
index b0c512aec..7b967a165 100644
--- a/tests/mir-opt/lower_slice_len.rs
+++ b/tests/mir-opt/lower_slice_len.rs
@@ -1,8 +1,10 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// 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.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index 137688ff6..b4bd45ba5 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -31,7 +31,7 @@
}
bb0: {
-- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2];
+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
}
diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
index 137688ff6..b4bd45ba5 100644
--- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
+++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff
@@ -31,7 +31,7 @@
}
bb0: {
-- FakeRead(ForMatchedPlace(None), _2);
+ PlaceMention(_2);
- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2];
+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
}
diff --git a/tests/mir-opt/match_arm_scopes.rs b/tests/mir-opt/match_arm_scopes.rs
index e0249de86..43746e993 100644
--- a/tests/mir-opt/match_arm_scopes.rs
+++ b/tests/mir-opt/match_arm_scopes.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that StorageDead and Drops are generated properly for bindings in
// matches:
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 8764236bf..ebb2f70a4 100644
--- a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir
@@ -26,7 +26,7 @@ fn main() -> () {
_2 = const true;
FakeRead(ForLet(None), _2);
StorageLive(_3);
- FakeRead(ForMatchedPlace(None), _1);
+ PlaceMention(_1);
_6 = Le(const 0_i32, _1);
switchInt(move _6) -> [0: bb4, otherwise: bb1];
}
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.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.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/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 1d6b83073..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,14 +24,14 @@
| '?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;
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 c581d0f84..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,8 +17,8 @@
| '?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: ();
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 48243e34d..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,8 +17,8 @@
| '?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: ();
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 adbd1f353..dd20e4a54 100644
--- a/tests/mir-opt/no_drop_for_inactive_variant.rs
+++ b/tests/mir-opt/no_drop_for_inactive_variant.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Ensure that there are no drop terminators in `unwrap<T>` (except the one along the cleanup
diff --git a/tests/mir-opt/no_spurious_drop_after_call.rs b/tests/mir-opt/no_spurious_drop_after_call.rs
index 71f050502..cd7b8fb79 100644
--- a/tests/mir-opt/no_spurious_drop_after_call.rs
+++ b/tests/mir-opt/no_spurious_drop_after_call.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// Test that after the call to `std::mem::drop` we do not generate a
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 1342966aa..000000000
--- a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-- // MIR for `opt` before InstSimplify
-+ // MIR for `opt` after InstSimplify
-
- fn opt(_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/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_simple.rs b/tests/mir-opt/nrvo_simple.rs
index 9e822ed51..5b403c560 100644
--- a/tests/mir-opt/nrvo_simple.rs
+++ b/tests/mir-opt/nrvo_simple.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RenameReturnPlace
diff --git a/tests/mir-opt/packed_struct_drop_aligned.rs b/tests/mir-opt/packed_struct_drop_aligned.rs
index f88a68353..079c4e68f 100644
--- a/tests/mir-opt/packed_struct_drop_aligned.rs
+++ b/tests/mir-opt/packed_struct_drop_aligned.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
index 430300419..d1d400af2 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.rs
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
index 23d78e987..d386219f4 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.rs
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// needs-unwind
// only-x86_64
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
index 75f81c5aa..cf7feef00 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -8,59 +8,62 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
debug start => _1;
debug n => _2;
let _3: std::option::Option<u32>;
- let mut _6: bool;
- let mut _7: u32;
- let mut _8: &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 => _8;
- let mut _5: bool;
+ debug self => _4;
+ let mut _6: bool;
scope 4 (inlined Option::<u32>::is_some) {
- debug self => _8;
- let mut _4: isize;
+ debug self => _4;
+ let mut _5: isize;
}
}
scope 5 (inlined core::num::<impl u32>::wrapping_add) {
debug self => _1;
- debug rhs => _7;
+ debug rhs => _8;
}
}
bb0: {
- StorageLive(_6);
- StorageLive(_8);
+ 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);
- _4 = discriminant(_3);
- _5 = Eq(_4, const 1_isize);
- _6 = Not(move _5);
+ _5 = discriminant(_3);
+ _6 = Eq(_5, const 1_isize);
StorageDead(_5);
- switchInt(move _6) -> [0: bb2, otherwise: bb3];
+ _7 = Not(move _6);
+ StorageDead(_6);
+ switchInt(move _7) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_3);
- StorageDead(_8);
+ StorageDead(_4);
goto -> bb4;
}
bb3: {
StorageDead(_3);
- StorageDead(_8);
+ StorageDead(_4);
assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
}
bb4: {
- StorageDead(_6);
- StorageLive(_7);
- _7 = _2 as u32 (IntToInt);
- _0 = Add(_1, _7);
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 65d71199a..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
@@ -4,6 +4,7 @@ fn ub_if_b(_1: Thing) -> Thing {
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) {
@@ -13,15 +14,9 @@ fn ub_if_b(_1: Thing) -> Thing {
bb0: {
_2 = discriminant(_1);
- switchInt(move _2) -> [0: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 0_isize);
+ assume(move _3);
_0 = move _1;
return;
}
-
- bb2: {
- unreachable;
- }
}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index e32e04384..565bd89e5 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
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..50189d192
--- /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): 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: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): 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..6966762a1
--- /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): 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: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): 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..08a185bad
--- /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): 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: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): 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..6501cb85e
--- /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): 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: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): 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
index 4db829a5e..8dbb68899 100644
--- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -6,19 +6,18 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
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: 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: ();
- let mut _12: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
scope 1 {
- debug iter => _5;
+ 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 => _12;
+ debug self => _5;
let mut _6: &mut impl Iterator<Item = T>;
let mut _7: &mut impl Fn(T) -> Option<U>;
}
@@ -28,25 +27,22 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb0: {
- StorageLive(_4);
- StorageLive(_3);
_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;
- StorageDead(_3);
- StorageLive(_5);
- _5 = move _4;
goto -> bb2;
}
bb2: {
StorageLive(_8);
+ _5 = &mut _4;
StorageLive(_6);
- _6 = &mut (_5.0: impl Iterator<Item = T>);
+ _6 = &mut (_4.0: impl Iterator<Item = T>);
StorageLive(_7);
- _7 = &mut (_5.1: impl Fn(T) -> Option<U>);
+ _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];
}
@@ -59,11 +55,10 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
bb4: {
StorageDead(_8);
- drop(_5) -> [return: bb5, unwind continue];
+ drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_5);
StorageDead(_4);
return;
}
@@ -83,7 +78,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate(cleanup)];
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
index 0d79f2de1..49f685cfa 100644
--- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -6,35 +6,35 @@ fn int_range(_1: usize, _2: usize) -> () {
let mut _0: ();
let mut _3: std::ops::Range<usize>;
let mut _4: std::ops::Range<usize>;
- let mut _8: std::option::Option<usize>;
- let mut _11: isize;
- let _13: ();
- let mut _14: &mut 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 _12: usize;
+ let _15: usize;
scope 2 {
- debug i => _12;
+ debug i => _15;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _14;
+ debug self => _5;
scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _14;
- let mut _7: bool;
- let _9: usize;
- let mut _10: usize;
- let mut _15: &usize;
- let mut _16: &usize;
+ 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 => _9;
+ debug old => _12;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _15;
- debug other => _16;
- let mut _5: usize;
- let mut _6: usize;
+ debug self => _6;
+ debug other => _7;
+ let mut _8: usize;
+ let mut _9: usize;
}
}
}
@@ -51,63 +51,66 @@ fn int_range(_1: usize, _2: usize) -> () {
}
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);
- StorageLive(_7);
- StorageLive(_15);
- StorageLive(_16);
- StorageLive(_5);
- _5 = (_4.0: usize);
- StorageLive(_6);
- _6 = (_4.1: usize);
- _7 = Lt(move _5, move _6);
- StorageDead(_6);
- StorageDead(_5);
- switchInt(move _7) -> [0: bb2, otherwise: bb3];
+ _9 = (_4.1: usize);
+ _10 = Lt(move _8, move _9);
+ StorageDead(_9);
+ StorageDead(_8);
+ switchInt(move _10) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_16);
- StorageDead(_15);
- _8 = Option::<usize>::None;
+ StorageDead(_7);
+ StorageDead(_6);
+ _11 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_16);
- StorageDead(_15);
- _9 = (_4.0: usize);
- StorageLive(_10);
- _10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];
+ 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 _10;
- StorageDead(_10);
- _8 = Option::<usize>::Some(_9);
+ (_4.0: usize) = move _13;
+ StorageDead(_13);
+ _11 = Option::<usize>::Some(_12);
goto -> bb5;
}
bb5: {
- StorageDead(_7);
- StorageDead(_9);
- _11 = discriminant(_8);
- switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9];
+ StorageDead(_10);
+ StorageDead(_12);
+ _14 = discriminant(_11);
+ switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9];
}
bb6: {
- StorageDead(_8);
+ StorageDead(_11);
StorageDead(_4);
return;
}
bb7: {
- _12 = ((_8 as Some).0: usize);
- _13 = opaque::<usize>(move _12) -> [return: bb8, unwind continue];
+ _15 = ((_11 as Some).0: usize);
+ _16 = opaque::<usize>(move _15) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_8);
+ StorageDead(_11);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
index c30df7425..30bdc1310 100644
--- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -6,16 +6,15 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
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: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _6: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _7: std::option::Option<U>;
- let mut _8: isize;
- let _10: ();
+ 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 => _5;
- let _9: U;
+ debug iter => _4;
+ let _8: U;
scope 2 {
- debug x => _9;
+ debug x => _8;
}
}
scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) {
@@ -23,50 +22,45 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb0: {
- StorageLive(_4);
- StorageLive(_3);
_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;
- StorageDead(_3);
- StorageLive(_5);
- _5 = move _4;
goto -> bb2;
}
bb2: {
- StorageLive(_7);
StorageLive(_6);
- _6 = &mut _5;
- _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _6) -> [return: bb3, unwind: bb9];
+ 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(_6);
- _8 = discriminant(_7);
- switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8];
+ StorageDead(_5);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb8];
}
bb4: {
- StorageDead(_7);
- drop(_5) -> [return: bb5, unwind continue];
+ StorageDead(_6);
+ drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_5);
StorageDead(_4);
return;
}
bb6: {
- _9 = move ((_7 as Some).0: U);
- _10 = opaque::<U>(move _9) -> [return: bb7, unwind: bb9];
+ _8 = move ((_6 as Some).0: U);
+ _9 = opaque::<U>(move _8) -> [return: bb7, unwind: bb9];
}
bb7: {
- StorageDead(_7);
+ StorageDead(_6);
goto -> bb2;
}
@@ -75,7 +69,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate(cleanup)];
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
index f3ba40922..7f9c26f4f 100644
--- a/tests/mir-opt/pre-codegen/loops.rs
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -g
// needs-unwind
diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs
index a139848ba..18c4653d4 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.rs
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
index 681e9666e..bddd961c9 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ 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
index db16b8d82..297ebd79f 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ 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-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
index 681e9666e..bddd961c9 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ 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
index db16b8d82..297ebd79f 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
index 704f8f887..bb089ea44 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
index 9664ccfb0..91c3731f4 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
- let mut _9: std::option::Option<u32>;
- let mut _12: isize;
- let mut _14: &impl Fn(u32);
- let mut _15: (u32,);
- let _16: ();
- let mut _17: &mut 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 _13: u32;
+ let _16: u32;
scope 2 {
- debug x => _13;
+ debug x => _16;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
- debug self => _17;
+ debug self => _6;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _17;
- let mut _8: bool;
- let _10: u32;
- let mut _11: u32;
- let mut _18: &u32;
- let mut _19: &u32;
+ 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 => _10;
+ debug old => _13;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _18;
- debug other => _19;
- let mut _6: u32;
- let mut _7: u32;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
}
}
}
@@ -54,52 +54,55 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
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);
- StorageLive(_8);
- StorageLive(_18);
- StorageLive(_19);
- StorageLive(_6);
- _6 = (_5.0: u32);
- StorageLive(_7);
- _7 = (_5.1: u32);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_19);
- StorageDead(_18);
- _9 = Option::<u32>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_19);
- StorageDead(_18);
- _10 = (_5.0: u32);
- StorageLive(_11);
- _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
+ 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 _11;
- StorageDead(_11);
- _9 = Option::<u32>::Some(_10);
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind unreachable];
}
@@ -109,18 +112,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: u32);
- StorageLive(_14);
- _14 = &_3;
- StorageLive(_15);
- _15 = (_13,);
- _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind unreachable];
+ _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(_15);
- StorageDead(_14);
- StorageDead(_9);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index dc8b46b6c..f76de02c9 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
- let mut _9: std::option::Option<u32>;
- let mut _12: isize;
- let mut _14: &impl Fn(u32);
- let mut _15: (u32,);
- let _16: ();
- let mut _17: &mut 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 _13: u32;
+ let _16: u32;
scope 2 {
- debug x => _13;
+ debug x => _16;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
- debug self => _17;
+ debug self => _6;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _17;
- let mut _8: bool;
- let _10: u32;
- let mut _11: u32;
- let mut _18: &u32;
- let mut _19: &u32;
+ 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 => _10;
+ debug old => _13;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _18;
- debug other => _19;
- let mut _6: u32;
- let mut _7: u32;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
}
}
}
@@ -54,52 +54,55 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
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);
- StorageLive(_8);
- StorageLive(_18);
- StorageLive(_19);
- StorageLive(_6);
- _6 = (_5.0: u32);
- StorageLive(_7);
- _7 = (_5.1: u32);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_19);
- StorageDead(_18);
- _9 = Option::<u32>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_19);
- StorageDead(_18);
- _10 = (_5.0: u32);
- StorageLive(_11);
- _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];
+ 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 _11;
- StorageDead(_11);
- _9 = Option::<u32>::Some(_10);
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind continue];
}
@@ -109,18 +112,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: u32);
- StorageLive(_14);
- _14 = &_3;
- StorageLive(_15);
- _15 = (_13,);
- _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind: bb11];
+ _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(_15);
- StorageDead(_14);
- StorageDead(_9);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
index fff713b5a..a7824f36d 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -7,65 +7,67 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
debug self => _1;
scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _1;
- let mut _4: bool;
- let _5: u32;
- let mut _6: u32;
- let mut _7: &u32;
- let mut _8: &u32;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
scope 3 {
- debug old => _5;
+ debug old => _7;
scope 4 {
}
}
scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _7;
- debug other => _8;
- let mut _2: u32;
- let mut _3: u32;
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
}
}
}
bb0: {
- StorageLive(_5);
- StorageLive(_4);
StorageLive(_7);
- StorageLive(_8);
+ StorageLive(_6);
StorageLive(_2);
- _2 = ((*_1).0: u32);
+ _2 = &((*_1).0: u32);
StorageLive(_3);
- _3 = ((*_1).1: u32);
- _4 = Lt(move _2, move _3);
- StorageDead(_3);
- StorageDead(_2);
- switchInt(move _4) -> [0: bb1, otherwise: bb2];
+ _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(_8);
- StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
- StorageDead(_8);
- StorageDead(_7);
- _5 = ((*_1).0: u32);
- StorageLive(_6);
- _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable];
+ 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 _6;
- StorageDead(_6);
- _0 = Option::<u32>::Some(_5);
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
goto -> bb4;
}
bb4: {
- StorageDead(_4);
- StorageDead(_5);
+ 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
index cc12c0122..83c9e6c1a 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -7,65 +7,67 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
debug self => _1;
scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _1;
- let mut _4: bool;
- let _5: u32;
- let mut _6: u32;
- let mut _7: &u32;
- let mut _8: &u32;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
scope 3 {
- debug old => _5;
+ debug old => _7;
scope 4 {
}
}
scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _7;
- debug other => _8;
- let mut _2: u32;
- let mut _3: u32;
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
}
}
}
bb0: {
- StorageLive(_5);
- StorageLive(_4);
StorageLive(_7);
- StorageLive(_8);
+ StorageLive(_6);
StorageLive(_2);
- _2 = ((*_1).0: u32);
+ _2 = &((*_1).0: u32);
StorageLive(_3);
- _3 = ((*_1).1: u32);
- _4 = Lt(move _2, move _3);
- StorageDead(_3);
- StorageDead(_2);
- switchInt(move _4) -> [0: bb1, otherwise: bb2];
+ _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(_8);
- StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
- StorageDead(_8);
- StorageDead(_7);
- _5 = ((*_1).0: u32);
- StorageLive(_6);
- _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue];
+ 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 _6;
- StorageDead(_6);
- _0 = Option::<u32>::Some(_5);
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
goto -> bb4;
}
bb4: {
- StorageDead(_4);
- StorageDead(_5);
+ 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 955214478..80b1a5b2f 100644
--- a/tests/mir-opt/pre-codegen/range_iter.rs
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
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 48b780aea..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
@@ -3,9 +3,9 @@
fn ezmap(_1: Option<i32>) -> Option<i32> {
debug x => _1;
let mut _0: std::option::Option<i32>;
- scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:17:12: 17:15}>) {
+ 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:17:12: 17:15};
+ 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;
@@ -18,6 +18,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb0: {
+ StorageLive(_2);
_2 = discriminant(_1);
switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -37,6 +38,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb3: {
+ StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index d4f28dda6..35f9ab3e1 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs
index aba951acd..483e58766 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.rs
+++ b/tests/mir-opt/pre-codegen/slice_filter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
index ed286beb4..548767dca 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_a::{closure#0}` after PreCodegen
-fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
@@ -10,74 +10,74 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
let _8: &usize;
let mut _9: &(usize, usize, usize, usize);
let _10: &usize;
- let _11: &usize;
- let mut _16: bool;
- let _17: &usize;
- let mut _22: bool;
- let _23: &usize;
- let mut _28: bool;
- let _29: &usize;
- let mut _34: &&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 mut _36: &&usize;
+ let _36: &usize;
let mut _37: &&usize;
- let mut _38: &&usize;
- let mut _39: &&usize;
- let mut _40: &&usize;
- let mut _41: &&usize;
scope 1 {
debug a => _4;
debug b => _6;
debug c => _8;
debug d => _10;
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _34;
- debug other => _35;
- let mut _12: &usize;
- let mut _13: &usize;
+ debug self => _11;
+ debug other => _13;
+ let mut _14: &usize;
+ let mut _15: &usize;
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _12;
- debug other => _13;
- let mut _14: usize;
- let mut _15: usize;
+ debug self => _14;
+ debug other => _15;
+ let mut _16: usize;
+ let mut _17: usize;
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _36;
- debug other => _37;
- let mut _18: &usize;
- let mut _19: &usize;
+ debug self => _19;
+ debug other => _21;
+ let mut _22: &usize;
+ let mut _23: &usize;
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _18;
- debug other => _19;
- let mut _20: usize;
- let mut _21: usize;
+ debug self => _22;
+ debug other => _23;
+ let mut _24: usize;
+ let mut _25: usize;
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _38;
- debug other => _39;
- let mut _24: &usize;
- let mut _25: &usize;
- scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _24;
- debug other => _25;
- let mut _26: usize;
- let mut _27: usize;
- }
- }
- scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _40;
- debug other => _41;
+ debug self => _27;
+ debug other => _29;
let mut _30: &usize;
let mut _31: &usize;
- scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
+ scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _30;
debug other => _31;
let mut _32: usize;
let mut _33: usize;
}
}
+ scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _35;
+ debug other => _37;
+ let mut _38: &usize;
+ let mut _39: &usize;
+ scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _38;
+ debug other => _39;
+ let mut _40: usize;
+ let mut _41: usize;
+ }
+ }
}
bb0: {
@@ -93,123 +93,147 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_10);
_9 = deref_copy (*_2);
_10 = &((*_9).3: usize);
- StorageLive(_16);
- StorageLive(_34);
- StorageLive(_35);
+ StorageLive(_18);
StorageLive(_11);
- _11 = _8;
- _12 = deref_copy _4;
- _13 = deref_copy _11;
+ _11 = &_4;
+ StorageLive(_13);
+ StorageLive(_12);
+ _12 = _8;
+ _13 = &_12;
StorageLive(_14);
- _14 = (*_12);
StorageLive(_15);
- _15 = (*_13);
- _16 = Le(move _14, move _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 _16) -> [0: bb1, otherwise: bb2];
+ switchInt(move _18) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_12);
+ StorageDead(_13);
StorageDead(_11);
- StorageDead(_35);
- StorageDead(_34);
goto -> bb4;
}
bb2: {
+ StorageDead(_12);
+ StorageDead(_13);
StorageDead(_11);
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_22);
- StorageLive(_36);
- StorageLive(_37);
- StorageLive(_17);
- _17 = _6;
- _18 = deref_copy _10;
- _19 = deref_copy _17;
- StorageLive(_20);
- _20 = (*_18);
+ StorageLive(_26);
+ StorageLive(_19);
+ _19 = &_10;
StorageLive(_21);
- _21 = (*_19);
- _22 = Le(move _20, move _21);
- StorageDead(_21);
- StorageDead(_20);
- switchInt(move _22) -> [0: bb3, otherwise: bb8];
+ 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(_17);
- StorageDead(_37);
- StorageDead(_36);
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
goto -> bb4;
}
bb4: {
- StorageLive(_28);
- StorageLive(_38);
- StorageLive(_39);
- StorageLive(_23);
- _23 = _4;
- _24 = deref_copy _8;
- _25 = deref_copy _23;
- StorageLive(_26);
- _26 = (*_24);
+ StorageLive(_34);
StorageLive(_27);
- _27 = (*_25);
- _28 = Le(move _26, move _27);
- StorageDead(_27);
- StorageDead(_26);
- switchInt(move _28) -> [0: bb5, otherwise: bb6];
+ _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(_23);
- StorageDead(_39);
- StorageDead(_38);
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
_0 = const false;
goto -> bb7;
}
bb6: {
- StorageDead(_23);
- StorageDead(_39);
- StorageDead(_38);
+ 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);
- StorageLive(_29);
- _29 = _10;
- _30 = deref_copy _6;
- _31 = deref_copy _29;
- StorageLive(_32);
- _32 = (*_30);
- StorageLive(_33);
- _33 = (*_31);
- _0 = Le(move _32, move _33);
- StorageDead(_33);
- StorageDead(_32);
- StorageDead(_29);
+ _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(_28);
+ StorageDead(_34);
goto -> bb9;
}
bb8: {
- StorageDead(_17);
- StorageDead(_37);
- StorageDead(_36);
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
_0 = const true;
goto -> bb9;
}
bb9: {
- StorageDead(_22);
- StorageDead(_16);
+ StorageDead(_26);
+ StorageDead(_18);
StorageDead(_10);
StorageDead(_8);
StorageDead(_6);
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
index 80c8cebff..e2ed1d101 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_b::{closure#0}` after PreCodegen
-fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: usize;
diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs
index 57ffb07e2..5225fc5c6 100644
--- a/tests/mir-opt/pre-codegen/slice_index.rs
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
index 2fd669aee..729841ec5 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
@@ -19,11 +19,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _15: usize;
- let _16: usize;
scope 4 {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
scope 5 {
let _6: usize;
scope 6 {
@@ -56,8 +54,8 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
@@ -82,8 +80,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -104,8 +100,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_16);
- StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
index 2fd669aee..729841ec5 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
@@ -19,11 +19,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _15: usize;
- let _16: usize;
scope 4 {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
scope 5 {
let _6: usize;
scope 6 {
@@ -56,8 +54,8 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
@@ -82,8 +80,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -104,8 +100,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_16);
- StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
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
index df6d2263d..d97c96ac8 100644
--- 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
@@ -7,17 +7,13 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
debug self => _1;
debug index => _2;
- let _3: &[u32];
}
bb0: {
- StorageLive(_3);
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- _0 = _3;
- StorageDead(_3);
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
index cc1795c3f..4a976002f 100644
--- 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
@@ -7,17 +7,13 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
debug self => _1;
debug index => _2;
- let _3: &[u32];
}
bb0: {
- StorageLive(_3);
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
}
bb1: {
- _0 = _3;
- StorageDead(_3);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
index 4afe2eda1..ac1de7b4c 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
@@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
let mut _3: usize;
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
- let mut _9: std::option::Option<usize>;
- let mut _12: isize;
- let mut _14: usize;
- let mut _15: bool;
- let mut _17: &impl Fn(usize, &T);
- let mut _18: (usize, &T);
- let _19: ();
- let mut _20: &mut 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 _13: usize;
+ let _16: usize;
scope 2 {
- debug i => _13;
- let _16: &T;
+ debug i => _16;
+ let _19: &T;
scope 3 {
- debug x => _16;
+ debug x => _19;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _20;
+ debug self => _6;
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _20;
- let mut _8: bool;
- let _10: usize;
- let mut _11: usize;
- let mut _21: &usize;
- let mut _22: &usize;
+ 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 => _10;
+ debug old => _13;
scope 8 {
}
}
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _21;
- debug other => _22;
- let mut _6: usize;
- let mut _7: usize;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
}
}
}
@@ -63,52 +63,55 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
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);
- StorageLive(_8);
- StorageLive(_21);
- StorageLive(_22);
- StorageLive(_6);
- _6 = (_5.0: usize);
- StorageLive(_7);
- _7 = (_5.1: usize);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_22);
- StorageDead(_21);
- _9 = Option::<usize>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_22);
- StorageDead(_21);
- _10 = (_5.0: usize);
- StorageLive(_11);
- _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
+ 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 _11;
- StorageDead(_11);
- _9 = Option::<usize>::Some(_10);
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_2) -> [return: bb7, unwind unreachable];
}
@@ -118,25 +121,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: usize);
- _14 = Len((*_1));
- _15 = Lt(_13, _14);
- assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable];
+ _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: {
- _16 = &(*_1)[_13];
- StorageLive(_17);
- _17 = &_2;
- StorageLive(_18);
- _18 = (_13, _16);
- _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind unreachable];
+ _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(_18);
- StorageDead(_17);
- StorageDead(_9);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index 48092608d..3c49ecf95 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
let mut _3: usize;
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
- let mut _9: std::option::Option<usize>;
- let mut _12: isize;
- let mut _14: usize;
- let mut _15: bool;
- let mut _17: &impl Fn(usize, &T);
- let mut _18: (usize, &T);
- let _19: ();
- let mut _20: &mut 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 _13: usize;
+ let _16: usize;
scope 2 {
- debug i => _13;
- let _16: &T;
+ debug i => _16;
+ let _19: &T;
scope 3 {
- debug x => _16;
+ debug x => _19;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _20;
+ debug self => _6;
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _20;
- let mut _8: bool;
- let _10: usize;
- let mut _11: usize;
- let mut _21: &usize;
- let mut _22: &usize;
+ 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 => _10;
+ debug old => _13;
scope 8 {
}
}
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _21;
- debug other => _22;
- let mut _6: usize;
- let mut _7: usize;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
}
}
}
@@ -63,52 +63,55 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
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);
- StorageLive(_8);
- StorageLive(_21);
- StorageLive(_22);
- StorageLive(_6);
- _6 = (_5.0: usize);
- StorageLive(_7);
- _7 = (_5.1: usize);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_22);
- StorageDead(_21);
- _9 = Option::<usize>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_22);
- StorageDead(_21);
- _10 = (_5.0: usize);
- StorageLive(_11);
- _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12];
+ 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 _11;
- StorageDead(_11);
- _9 = Option::<usize>::Some(_10);
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_2) -> [return: bb7, unwind continue];
}
@@ -118,25 +121,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: usize);
- _14 = Len((*_1));
- _15 = Lt(_13, _14);
- assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind: bb12];
+ _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: {
- _16 = &(*_1)[_13];
- StorageLive(_17);
- _17 = &_2;
- StorageLive(_18);
- _18 = (_13, _16);
- _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind: bb12];
+ _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(_18);
- StorageDead(_17);
- StorageDead(_9);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
goto -> bb1;
}
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
index 549cb4f46..f3760463f 100644
--- 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
@@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
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 _17: std::option::Option<&T>;
- let mut _18: isize;
- let mut _20: &impl Fn(&T);
- let mut _21: (&T,);
- let _22: ();
- let mut _23: &mut 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 _19: &T;
+ let _20: &T;
scope 2 {
- debug x => _19;
+ debug x => _20;
}
scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
- debug self => _23;
- let mut _16: &mut std::slice::Iter<'_, T>;
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@@ -153,20 +153,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
StorageLive(_17);
- StorageLive(_16);
- _16 = &mut (_15.0: std::slice::Iter<'_, T>);
- _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable];
+ _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(_16);
- _18 = discriminant(_17);
- switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_17);
+ StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind unreachable];
}
@@ -176,18 +177,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
- _19 = ((_17 as Some).0: &T);
- StorageLive(_20);
- _20 = &_2;
+ _20 = ((_18 as Some).0: &T);
StorageLive(_21);
- _21 = (_19,);
- _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable];
+ _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(_20);
- StorageDead(_17);
+ StorageDead(_18);
goto -> bb4;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
index 3cdc49f60..e63f8b893 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
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 _17: std::option::Option<&T>;
- let mut _18: isize;
- let mut _20: &impl Fn(&T);
- let mut _21: (&T,);
- let _22: ();
- let mut _23: &mut 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 _19: &T;
+ let _20: &T;
scope 2 {
- debug x => _19;
+ debug x => _20;
}
scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
- debug self => _23;
- let mut _16: &mut std::slice::Iter<'_, T>;
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@@ -153,20 +153,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
StorageLive(_17);
- StorageLive(_16);
- _16 = &mut (_15.0: std::slice::Iter<'_, T>);
- _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11];
+ _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(_16);
- _18 = discriminant(_17);
- switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_17);
+ StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind continue];
}
@@ -176,18 +177,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
- _19 = ((_17 as Some).0: &T);
- StorageLive(_20);
- _20 = &_2;
+ _20 = ((_18 as Some).0: &T);
StorageLive(_21);
- _21 = (_19,);
- _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11];
+ _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(_20);
- StorageDead(_17);
+ StorageDead(_18);
goto -> bb4;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index 179005636..10a5c3070 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
index 1d3317efd..485dc9179 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
@@ -1,21 +1,18 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
- _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:10:5: 10:14
- // mir::ConstOperand
- // + span: $DIR/spans.rs:10:5: 10:10
- // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
+ 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
}
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
- return; // scope 0 at $DIR/spans.rs:11:2: 11:2
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
index aba66861f..485dc9179 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
@@ -1,21 +1,18 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
- _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:10:5: 10:14
- // mir::ConstOperand
- // + span: $DIR/spans.rs:10:5: 10:10
- // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
+ 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
}
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
- return; // scope 0 at $DIR/spans.rs:11:2: 11:2
+ 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
index 295eb0476..aa36648ce 100644
--- a/tests/mir-opt/pre-codegen/spans.rs
+++ b/tests/mir-opt/pre-codegen/spans.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the comments we emit in MIR opts are accurate.
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index a227c82d6..b6e4eaad7 100644
--- a/tests/mir-opt/pre-codegen/try_identity.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
index 8fe361f2b..1648f5dd8 100644
--- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
+++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
@@ -92,8 +92,8 @@
StorageDead(_7);
- StorageDead(_6);
- StorageLive(_10);
- StorageLive(_11);
- StorageLive(_12);
+- StorageLive(_11);
+- StorageLive(_12);
StorageLive(_13);
_26 = const _;
_13 = &(*_26);
@@ -105,8 +105,9 @@
bb5: {
StorageDead(_15);
StorageDead(_13);
- _11 = &(*_12);
- _16 = Len((*_11));
+- _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];
@@ -114,12 +115,15 @@
bb6: {
StorageLive(_19);
- _19 = &(*_11)[1 of 3];
+- _19 = &(*_11)[1 of 3];
++ _19 = &(*_12)[1 of 3];
StorageLive(_20);
- _20 = &(*_11)[2:-1];
+- _20 = &(*_11)[2:-1];
++ _20 = &(*_12)[2:-1];
StorageLive(_21);
- _21 = &(*_11)[-1 of 3];
+- _21 = &(*_11)[-1 of 3];
- _10 = const ();
++ _21 = &(*_12)[-1 of 3];
StorageDead(_21);
StorageDead(_20);
StorageDead(_19);
@@ -132,8 +136,8 @@
}
bb8: {
- StorageDead(_12);
- StorageDead(_11);
+- StorageDead(_12);
+- StorageDead(_11);
- StorageDead(_10);
StorageLive(_22);
StorageLive(_23);
diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs
index 610660131..36134e019 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;
{
@@ -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;
@@ -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;
@@ -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/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
index 6c469d744..54da6ee65 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff
@@ -13,8 +13,7 @@
let mut _8: bool;
bb0: {
-- FakeRead(ForMatchedPlace(None), _1);
-+ nop;
+ PlaceMention(_1);
_3 = discriminant(_1);
switchInt(move _3) -> [1: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
index 6c469d744..54da6ee65 100644
--- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
+++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff
@@ -13,8 +13,7 @@
let mut _8: bool;
bb0: {
-- FakeRead(ForMatchedPlace(None), _1);
-+ nop;
+ PlaceMention(_1);
_3 = discriminant(_1);
switchInt(move _3) -> [1: bb2, otherwise: bb1];
}
diff --git a/tests/mir-opt/remove_fake_borrows.rs b/tests/mir-opt/remove_fake_borrows.rs
index f0ee98f77..21c7b46ee 100644
--- a/tests/mir-opt/remove_fake_borrows.rs
+++ b/tests/mir-opt/remove_fake_borrows.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the fake borrows for matches are removed after borrow checking.
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
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.rs b/tests/mir-opt/remove_storage_markers.rs
index 330264461..6666ff3b7 100644
--- a/tests/mir-opt/remove_storage_markers.rs
+++ b/tests/mir-opt/remove_storage_markers.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RemoveStorageMarkers
diff --git a/tests/mir-opt/remove_unneeded_drops.rs b/tests/mir-opt/remove_unneeded_drops.rs
index 178d0924c..cad79e0aa 100644
--- a/tests/mir-opt/remove_unneeded_drops.rs
+++ b/tests/mir-opt/remove_unneeded_drops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR remove_unneeded_drops.opt.RemoveUnneededDrops.diff
fn opt(x: bool) {
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.rs b/tests/mir-opt/retag.rs
index e0696de4d..1e4b017da 100644
--- a/tests/mir-opt/retag.rs
+++ b/tests/mir-opt/retag.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// unit-test: AddRetag
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// ignore-tidy-linelength
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
index d72477440..285db435f 100644
--- 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
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
+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;
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
index d72477440..285db435f 100644
--- 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
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo(_1: &Test, _2: &mut i32) -> &mut i32 {
+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;
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
index de3eb0d52..9ad607b2f 100644
--- 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
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo_shr` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo_shr` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
+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;
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
index de3eb0d52..9ad607b2f 100644
--- 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
@@ -1,6 +1,6 @@
-// MIR for `<impl at $DIR/retag.rs:12:1: 12:10>::foo_shr` after SimplifyCfg-elaborate-drops
+// MIR for `<impl at $DIR/retag.rs:13:1: 13:10>::foo_shr` after SimplifyCfg-elaborate-drops
-fn <impl at $DIR/retag.rs:12:1: 12:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 {
+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;
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 ca1528b6a..fe4b33001 100644
--- a/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
+++ b/tests/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff
@@ -48,15 +48,17 @@
bb0: {
StorageLive(_3);
+ StorageLive(_9);
StorageLive(_10);
StorageLive(_11);
_9 = discriminant(_1);
- switchInt(move _9) -> [0: bb7, 1: bb5, otherwise: bb6];
+ switchInt(move _9) -> [0: bb6, 1: bb5, otherwise: bb3];
}
bb1: {
StorageDead(_11);
StorageDead(_10);
+ StorageDead(_9);
_5 = discriminant(_3);
switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3];
}
@@ -90,10 +92,6 @@
}
bb6: {
- unreachable;
- }
-
- bb7: {
_10 = ((_1 as Ok).0: i32);
_3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(move _10);
goto -> bb1;
diff --git a/tests/mir-opt/separate_const_switch.rs b/tests/mir-opt/separate_const_switch.rs
index d333d4b6b..3f43cdf43 100644
--- a/tests/mir-opt/separate_const_switch.rs
+++ b/tests/mir-opt/separate_const_switch.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
#![feature(control_flow_enum)]
#![feature(try_trait_v2)]
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.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.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.panic-abort.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-abort.diff
index d39571583..64a435f22 100644
--- 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
@@ -3,18 +3,15 @@
fn main() -> () {
let mut _0: ();
- let mut _1: bool;
- let _2: ();
+ let _1: ();
bb0: {
- StorageLive(_1);
- _1 = const false;
- switchInt(const false) -> [0: bb3, otherwise: bb1];
+ goto -> bb3;
}
bb1: {
- _2 = noop() -> [return: bb2, unwind unreachable];
+ _1 = noop() -> [return: bb2, unwind unreachable];
}
bb2: {
@@ -26,7 +23,6 @@
}
bb4: {
- StorageDead(_1);
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
index 81903c64d..146e00686 100644
--- 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
@@ -3,18 +3,15 @@
fn main() -> () {
let mut _0: ();
- let mut _1: bool;
- let _2: ();
+ let _1: ();
bb0: {
- StorageLive(_1);
- _1 = const false;
- switchInt(const false) -> [0: bb3, otherwise: bb1];
+ goto -> bb3;
}
bb1: {
- _2 = noop() -> [return: bb2, unwind continue];
+ _1 = noop() -> [return: bb2, unwind continue];
}
bb2: {
@@ -26,7 +23,6 @@
}
bb4: {
- StorageDead(_1);
return;
}
}
diff --git a/tests/mir-opt/simplify_if.rs b/tests/mir-opt/simplify_if.rs
index fff23b3ce..19b5806f7 100644
--- a/tests/mir-opt/simplify_if.rs
+++ b/tests/mir-opt/simplify_if.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
#[inline(never)]
fn noop() {}
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_fixedpoint.rs b/tests/mir-opt/simplify_locals_fixedpoint.rs
index 4da18b7fe..b0c6e2d8e 100644
--- a/tests/mir-opt/simplify_locals_fixedpoint.rs
+++ b/tests/mir-opt/simplify_locals_fixedpoint.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -Zmir-opt-level=1
diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.rs b/tests/mir-opt/simplify_locals_removes_unused_consts.rs
index 1e404c3a4..42879254d 100644
--- a/tests/mir-opt/simplify_locals_removes_unused_consts.rs
+++ b/tests/mir-opt/simplify_locals_removes_unused_consts.rs
@@ -1,3 +1,4 @@
+// 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.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.rs b/tests/mir-opt/simplify_match.rs
index 5d8e94b09..eb385005c 100644
--- a/tests/mir-opt/simplify_match.rs
+++ b/tests/mir-opt/simplify_match.rs
@@ -1,3 +1,4 @@
+// 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.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/spanview_block.main.built.after.html b/tests/mir-opt/spanview_block.main.built.after.html
index 56f4e4f93..54ef00f56 100644
--- a/tests/mir-opt/spanview_block.main.built.after.html
+++ b/tests/mir-opt/spanview_block.main.built.after.html
@@ -60,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 91af08d80..5e782b05f 100644
--- a/tests/mir-opt/spanview_statement.main.built.after.html
+++ b/tests/mir-opt/spanview_statement.main.built.after.html
@@ -60,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 1f42faedd..2a651489e 100644
--- a/tests/mir-opt/spanview_terminator.main.built.after.html
+++ b/tests/mir-opt/spanview_terminator.main.built.after.html
@@ -60,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.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.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/ssa_unreachable_116212.rs b/tests/mir-opt/ssa_unreachable_116212.rs
index f58866587..9f1cf223e 100644
--- a/tests/mir-opt/ssa_unreachable_116212.rs
+++ b/tests/mir-opt/ssa_unreachable_116212.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Regression test for issue #116212.
#![feature(never_type)]
diff --git a/tests/mir-opt/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir
index 13732daa7..782efd5ac 100644
--- a/tests/mir-opt/storage_ranges.main.nll.0.mir
+++ b/tests/mir-opt/storage_ranges.main.nll.0.mir
@@ -15,7 +15,7 @@
| '?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: ();
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
index 6678e4b3b..fc270fd33 100644
--- a/tests/mir-opt/switch_to_self.rs
+++ b/tests/mir-opt/switch_to_self.rs
@@ -1,3 +1,4 @@
+// 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"]
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.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 474f43104..000000000
--- a/tests/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
+++ /dev/null
@@ -1,60 +0,0 @@
-// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
-
-fn main() -> () {
- let mut _0: ();
- let _1: &str;
- let mut _2: Test1;
- let mut _3: isize;
- let _4: &str;
- let _5: &str;
- let _6: &str;
- let mut _7: Test2;
- let mut _8: isize;
- let _9: &str;
-
- bb0: {
- StorageLive(_1);
- StorageLive(_2);
- _2 = Test1::C;
- _3 = discriminant(_2);
- switchInt(move _3) -> [2: bb1, otherwise: bb2];
- }
-
- bb1: {
- StorageLive(_5);
- _5 = const "C";
- _1 = &(*_5);
- StorageDead(_5);
- StorageDead(_2);
- StorageDead(_1);
- StorageLive(_6);
- StorageLive(_7);
- _7 = Test2::D;
- _8 = discriminant(_7);
- switchInt(move _8) -> [4: bb4, 5: bb3, otherwise: bb2];
- }
-
- bb2: {
- unreachable;
- }
-
- bb3: {
- StorageLive(_9);
- _9 = const "E";
- _6 = &(*_9);
- StorageDead(_9);
- goto -> bb5;
- }
-
- bb4: {
- _6 = const "D";
- goto -> bb5;
- }
-
- bb5: {
- StorageDead(_7);
- StorageDead(_6);
- _0 = const ();
- return;
- }
-}
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 9db95abec..000000000
--- a/tests/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff
+++ /dev/null
@@ -1,80 +0,0 @@
-- // MIR for `main` before UninhabitedEnumBranching
-+ // MIR for `main` after UninhabitedEnumBranching
-
- fn main() -> () {
- let mut _0: ();
- let _1: &str;
- let mut _2: Test1;
- let mut _3: isize;
- let _4: &str;
- let _5: &str;
- let _6: &str;
- let mut _7: Test2;
- let mut _8: isize;
- let _9: &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) -> [2: bb1, otherwise: bb2];
- }
-
- 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);
- StorageLive(_6);
- StorageLive(_7);
- _7 = Test2::D;
- _8 = discriminant(_7);
- switchInt(move _8) -> [4: bb7, 5: bb6, otherwise: bb2];
- }
-
- bb6: {
- StorageLive(_9);
- _9 = const "E";
- _6 = &(*_9);
- StorageDead(_9);
- goto -> bb8;
- }
-
- bb7: {
- _6 = const "D";
- goto -> bb8;
- }
-
- bb8: {
- StorageDead(_7);
- StorageDead(_6);
- _0 = const ();
- return;
- }
- }
-
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 9c0c5d189..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
+++ /dev/null
@@ -1,85 +0,0 @@
-// MIR for `main` after SimplifyCfg-after-uninhabited-enum-branching
-
-fn main() -> () {
- let mut _0: ();
- let _1: Plop;
- let mut _2: Test1;
- let _3: &str;
- let mut _4: &Test1;
- 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 = Test1::C;
- _1 = Plop { xx: const 51_u32, test1: move _2 };
- StorageDead(_2);
- StorageLive(_3);
- StorageLive(_4);
- _4 = &(_1.1: Test1);
- _5 = discriminant((*_4));
- switchInt(move _5) -> [2: bb3, 3: bb1, otherwise: bb2];
- }
-
- bb1: {
- StorageLive(_8);
- _8 = const "D";
- _3 = &(*_8);
- StorageDead(_8);
- goto -> bb4;
- }
-
- bb2: {
- unreachable;
- }
-
- bb3: {
- StorageLive(_7);
- _7 = const "C";
- _3 = &(*_7);
- StorageDead(_7);
- goto -> bb4;
- }
-
- bb4: {
- StorageDead(_4);
- StorageDead(_3);
- StorageLive(_9);
- _10 = discriminant((_1.1: Test1));
- switchInt(move _10) -> [2: bb6, 3: bb5, otherwise: bb2];
- }
-
- bb5: {
- StorageLive(_13);
- _13 = const "D";
- _9 = &(*_13);
- StorageDead(_13);
- goto -> bb7;
- }
-
- bb6: {
- StorageLive(_12);
- _12 = const "C";
- _9 = &(*_12);
- StorageDead(_12);
- goto -> bb7;
- }
-
- bb7: {
- StorageDead(_9);
- _0 = const ();
- StorageDead(_1);
- return;
- }
-}
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 12ce6505a..000000000
--- a/tests/mir-opt/uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
+++ /dev/null
@@ -1,115 +0,0 @@
-- // MIR for `main` before UninhabitedEnumBranching
-+ // MIR for `main` after UninhabitedEnumBranching
-
- fn main() -> () {
- let mut _0: ();
- let _1: Plop;
- let mut _2: Test1;
- let _3: &str;
- let mut _4: &Test1;
- 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 = Test1::C;
- _1 = Plop { xx: const 51_u32, test1: move _2 };
- StorageDead(_2);
- StorageLive(_3);
- StorageLive(_4);
- _4 = &(_1.1: Test1);
- _5 = discriminant((*_4));
-- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2];
-+ switchInt(move _5) -> [2: bb5, 3: bb1, otherwise: bb2];
- }
-
- 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: Test1));
-- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2];
-+ switchInt(move _10) -> [2: bb10, 3: bb7, otherwise: bb2];
- }
-
- 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;
- }
- }
-
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.keep_fallthrough.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
index 498e1e20f..79948139f 100644
--- a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
+++ b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff
@@ -9,7 +9,7 @@
bb0: {
_2 = discriminant(_1);
- switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
-+ switchInt(move _2) -> [1: bb3, otherwise: bb1];
++ switchInt(move _2) -> [0: bb5, 1: bb3, otherwise: bb1];
}
bb1: {
@@ -29,6 +29,10 @@
bb4: {
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.panic-abort.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff
deleted file mode 100644
index eb5a0c39b..000000000
--- a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-abort.diff
+++ /dev/null
@@ -1,67 +0,0 @@
-- // MIR for `main` before UnreachablePropagation
-+ // MIR for `main` after UnreachablePropagation
-
- fn main() -> () {
- let mut _0: ();
- let mut _1: std::option::Option<Empty>;
- let mut _2: isize;
- let _5: ();
- let mut _6: bool;
- let mut _7: !;
- 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];
-+ switchInt(move _2) -> [1: bb2, otherwise: bb3];
- }
-
- 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];
-- }
--
-- bb3: {
-- _4 = const 21_i32;
-- _5 = const ();
-- goto -> bb5;
-- }
--
-- bb4: {
-- _4 = const 42_i32;
-- _5 = const ();
-- goto -> bb5;
-- }
--
-- bb5: {
-- StorageDead(_6);
-- StorageDead(_5);
-- StorageLive(_7);
- unreachable;
- }
-
-- bb6: {
-+ bb3: {
- _0 = const ();
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff
deleted file mode 100644
index 906dce981..000000000
--- a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff
+++ /dev/null
@@ -1,67 +0,0 @@
-- // MIR for `main` before UnreachablePropagation
-+ // MIR for `main` after UnreachablePropagation
-
- fn main() -> () {
- let mut _0: ();
- let mut _1: std::option::Option<Empty>;
- let mut _2: isize;
- let _5: ();
- let mut _6: bool;
- let mut _7: !;
- 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];
-+ switchInt(move _2) -> [1: bb2, otherwise: bb3];
- }
-
- 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];
-- }
--
-- bb3: {
-- _4 = const 21_i32;
-- _5 = const ();
-- goto -> bb5;
-- }
--
-- bb4: {
-- _4 = const 42_i32;
-- _5 = const ();
-- goto -> bb5;
-- }
--
-- bb5: {
-- StorageDead(_6);
-- StorageDead(_5);
-- StorageLive(_7);
- unreachable;
- }
-
-- bb6: {
-+ bb3: {
- _0 = const ();
- StorageDead(_1);
- return;
- }
- }
-
diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs
index 23fad4737..5b96681d9 100644
--- a/tests/mir-opt/unreachable.rs
+++ b/tests/mir-opt/unreachable.rs
@@ -1,12 +1,31 @@
+// 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.panic-abort.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
index 713757ce6..11d7924e7 100644
--- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
+++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff
@@ -9,6 +9,7 @@
let _5: ();
let mut _6: bool;
let mut _7: !;
++ let mut _8: bool;
scope 1 {
debug x => _1;
scope 2 {
@@ -35,7 +36,10 @@
StorageLive(_5);
StorageLive(_6);
_6 = _1;
- switchInt(move _6) -> [0: bb4, otherwise: bb3];
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ _8 = Ne(_6, const false);
++ assume(move _8);
++ goto -> bb3;
}
bb3: {
diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
index a0479fb91..df6f5609f 100644
--- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
+++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff
@@ -9,6 +9,7 @@
let _5: ();
let mut _6: bool;
let mut _7: !;
++ let mut _8: bool;
scope 1 {
debug x => _1;
scope 2 {
@@ -35,7 +36,10 @@
StorageLive(_5);
StorageLive(_6);
_6 = _1;
- switchInt(move _6) -> [0: bb4, otherwise: bb3];
+- switchInt(move _6) -> [0: bb4, otherwise: bb3];
++ _8 = Ne(_6, const false);
++ assume(move _8);
++ goto -> bb3;
}
bb3: {
diff --git a/tests/mir-opt/unreachable_diverging.rs b/tests/mir-opt/unreachable_diverging.rs
index b7d308b86..b1df6f852 100644
--- a/tests/mir-opt/unreachable_diverging.rs
+++ b/tests/mir-opt/unreachable_diverging.rs
@@ -1,4 +1,6 @@
+// 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.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 e2edbfcd4..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,6 +1,6 @@
-// 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 = {
+const <impl at $DIR/unusual_item_types.rs:10:1: 10:7>::ASSOCIATED_CONSTANT: i32 = {
let mut _0: i32;
bb0: {
diff --git a/tests/mir-opt/while_storage.rs b/tests/mir-opt/while_storage.rs
deleted file mode 100644
index d4fb54da5..000000000
--- a/tests/mir-opt/while_storage.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
-// 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.panic-abort.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir
deleted file mode 100644
index c04fdeb63..000000000
--- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-abort.mir
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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;
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
- StorageLive(_2);
- _2 = get_bool(_1) -> [return: bb2, unwind unreachable];
- }
-
- bb2: {
- switchInt(move _2) -> [0: bb7, otherwise: bb3];
- }
-
- bb3: {
- StorageLive(_3);
- _3 = get_bool(_1) -> [return: bb4, unwind unreachable];
- }
-
- bb4: {
- switchInt(move _3) -> [0: bb5, otherwise: bb6];
- }
-
- bb5: {
- StorageDead(_3);
- StorageDead(_2);
- goto -> bb1;
- }
-
- bb6: {
- StorageDead(_3);
- goto -> bb7;
- }
-
- bb7: {
- StorageDead(_2);
- return;
- }
-}
diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
deleted file mode 100644
index 7dc4f7ab1..000000000
--- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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;
-
- bb0: {
- goto -> bb1;
- }
-
- bb1: {
- StorageLive(_2);
- _2 = get_bool(_1) -> [return: bb2, unwind continue];
- }
-
- bb2: {
- switchInt(move _2) -> [0: bb7, otherwise: bb3];
- }
-
- bb3: {
- StorageLive(_3);
- _3 = get_bool(_1) -> [return: bb4, unwind continue];
- }
-
- bb4: {
- switchInt(move _3) -> [0: bb5, otherwise: bb6];
- }
-
- bb5: {
- StorageDead(_3);
- StorageDead(_2);
- goto -> bb1;
- }
-
- bb6: {
- StorageDead(_3);
- goto -> bb7;
- }
-
- bb7: {
- StorageDead(_2);
- return;
- }
-}