summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /tests/mir-opt
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt')
-rw-r--r--tests/mir-opt/bool_compare.opt1.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt1.InstCombine.diff)4
-rw-r--r--tests/mir-opt/bool_compare.opt2.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt2.InstCombine.diff)4
-rw-r--r--tests/mir-opt/bool_compare.opt3.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt3.InstCombine.diff)4
-rw-r--r--tests/mir-opt/bool_compare.opt4.InstSimplify.diff (renamed from tests/mir-opt/bool_compare.opt4.InstCombine.diff)4
-rw-r--r--tests/mir-opt/bool_compare.rs10
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir178
-rw-r--r--tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir12
-rw-r--r--tests/mir-opt/building/custom/projections.rs25
-rw-r--r--tests/mir-opt/building/custom/projections.tuples.built.after.mir8
-rw-r--r--tests/mir-opt/building/enum_cast.bar.built.after.mir9
-rw-r--r--tests/mir-opt/building/enum_cast.boo.built.after.mir9
-rw-r--r--tests/mir-opt/building/enum_cast.droppy.built.after.mir9
-rw-r--r--tests/mir-opt/building/enum_cast.far.built.after.mir22
-rw-r--r--tests/mir-opt/building/enum_cast.offsetty.built.after.mir26
-rw-r--r--tests/mir-opt/building/enum_cast.rs42
-rw-r--r--tests/mir-opt/building/enum_cast.signy.built.after.mir26
-rw-r--r--tests/mir-opt/building/enum_cast.unsigny.built.after.mir17
-rw-r--r--tests/mir-opt/casts.redundant.InstSimplify.diff (renamed from tests/mir-opt/casts.redundant.InstCombine.diff)4
-rw-r--r--tests/mir-opt/casts.rs2
-rw-r--r--tests/mir-opt/combine_array_len.norm2.InstSimplify.diff (renamed from tests/mir-opt/combine_array_len.norm2.InstCombine.diff)4
-rw-r--r--tests/mir-opt/combine_array_len.rs4
-rw-r--r--tests/mir-opt/combine_clone_of_primitives.rs4
-rw-r--r--tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff (renamed from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff)4
-rw-r--r--tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff158
-rw-r--r--tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff90
-rw-r--r--tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff)4
-rw-r--r--tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff (renamed from tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff)4
-rw-r--r--tests/mir-opt/combine_transmutes.rs30
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir32
-rw-r--r--tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir36
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir30
-rw-r--r--tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir32
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir16
-rw-r--r--tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir14
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir6
-rw-r--r--tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff6
-rw-r--r--tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff46
-rw-r--r--tests/mir-opt/const_prop/address_of_pair.rs17
-rw-r--r--tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff18
-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.main.ConstProp.32bit.diff46
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff46
-rw-r--r--tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs3
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff22
-rw-r--r--tests/mir-opt/const_prop/invalid_constant.rs2
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff9
-rw-r--r--tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff9
-rw-r--r--tests/mir-opt/const_prop/large_array_index.rs2
-rw-r--r--tests/mir-opt/const_prop/mult_by_zero.rs3
-rw-r--r--tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff5
-rw-r--r--tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff1
-rw-r--r--tests/mir-opt/const_prop/mutable_variable.rs3
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff25
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate.rs3
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff11
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs3
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff3
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs3
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff33
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_no_prop.rs3
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff42
-rw-r--r--tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs3
-rw-r--r--tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff44
-rw-r--r--tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff40
-rw-r--r--tests/mir-opt/const_prop/offset_of.rs48
-rw-r--r--tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir25
-rw-r--r--tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir25
-rw-r--r--tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir25
-rw-r--r--tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir25
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff5
-rw-r--r--tests/mir-opt/const_prop/read_immutable_static.rs3
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff23
-rw-r--r--tests/mir-opt/const_prop/reify_fn_ptr.rs1
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff6
-rw-r--r--tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff6
-rw-r--r--tests/mir-opt/const_prop/repeat.rs5
-rw-r--r--tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir6
-rw-r--r--tests/mir-opt/const_prop/return_place.rs1
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff14
-rw-r--r--tests/mir-opt/const_prop/scalar_literal_propagation.rs1
-rw-r--r--tests/mir-opt/const_prop/slice_len.rs2
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.ConstProp.diff4
-rw-r--r--tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff4
-rw-r--r--tests/mir-opt/const_prop/switch_int.rs2
-rw-r--r--tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff)3
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff)3
-rw-r--r--tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff23
-rw-r--r--tests/mir-opt/const_prop/transmute.rs2
-rw-r--r--tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff23
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff23
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff23
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff22
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff22
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff25
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff)24
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff27
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff)16
-rw-r--r--tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff23
-rw-r--r--tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff)0
-rw-r--r--tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff15
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff13
-rw-r--r--tests/mir-opt/const_prop/tuple_literal_propagation.rs1
-rw-r--r--tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff (renamed from tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff)27
-rw-r--r--tests/mir-opt/const_prop/while_let_loops.rs (renamed from tests/mir-opt/while_let_loops.rs)2
-rw-r--r--tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff3
-rw-r--r--tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff3
-rw-r--r--tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff3
-rw-r--r--tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff12
-rw-r--r--tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff13
-rw-r--r--tests/mir-opt/copy-prop/partial_init.rs18
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff25
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.rs9
-rw-r--r--tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff (renamed from tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff)4
-rw-r--r--tests/mir-opt/dont_yeet_assert.rs4
-rw-r--r--tests/mir-opt/equal_true.opt.InstSimplify.diff (renamed from tests/mir-opt/equal_true.opt.InstCombine.diff)4
-rw-r--r--tests/mir-opt/equal_true.rs4
-rw-r--r--tests/mir-opt/inline/issue_106141.outer.Inline.diff2
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff162
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir162
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff162
-rw-r--r--tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir162
-rw-r--r--tests/mir-opt/inline/unsized_argument.caller.Inline.diff50
-rw-r--r--tests/mir-opt/inline/unsized_argument.rs15
-rw-r--r--tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff2
-rw-r--r--tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff (renamed from tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff)16
-rw-r--r--tests/mir-opt/instsimplify_duplicate_switch_targets.rs (renamed from tests/mir-opt/instcombine_duplicate_switch_targets.rs)4
-rw-r--r--tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff)4
-rw-r--r--tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff)4
-rw-r--r--tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff (renamed from tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff)4
-rw-r--r--tests/mir-opt/intrinsic_asserts.rs6
-rw-r--r--tests/mir-opt/issue_41888.main.ElaborateDrops.diff2
-rw-r--r--tests/mir-opt/issue_72181_1.f.built.after.mir14
-rw-r--r--tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff15
-rw-r--r--tests/mir-opt/issue_78192.f.InstSimplify.diff (renamed from tests/mir-opt/issue_78192.f.InstCombine.diff)4
-rw-r--r--tests/mir-opt/issue_78192.rs2
-rw-r--r--tests/mir-opt/issue_99325.main.built.after.mir4
-rw-r--r--tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir35
-rw-r--r--tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff4
-rw-r--r--tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff30
-rw-r--r--tests/mir-opt/lower_intrinsics.rs11
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff14
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff14
-rw-r--r--tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff14
-rw-r--r--tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff11
-rw-r--r--tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff8
-rw-r--r--tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff36
-rw-r--r--tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir25
-rw-r--r--tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir22
-rw-r--r--tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir56
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir36
-rw-r--r--tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir36
-rw-r--r--tests/mir-opt/not_equal_false.opt.InstSimplify.diff (renamed from tests/mir-opt/not_equal_false.opt.InstCombine.diff)4
-rw-r--r--tests/mir-opt/not_equal_false.rs4
-rw-r--r--tests/mir-opt/nrvo_miscompile_111005.rs22
-rw-r--r--tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff18
-rw-r--r--tests/mir-opt/pre-codegen/README.md3
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.rs17
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir27
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir26
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir22
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs (renamed from tests/mir-opt/lower_intrinsics_e2e.rs)8
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir16
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir53
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs17
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff (renamed from tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff)0
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff (renamed from tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff)0
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff (renamed from tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff)0
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff (renamed from tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff)0
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir18
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.rs (renamed from tests/mir-opt/const_prop/optimizes_into_variable.rs)1
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir91
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir95
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir20
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir20
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs31
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir56
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs (renamed from tests/mir-opt/simple_option_map_e2e.rs)6
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs27
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir105
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir134
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir26
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir20
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir203
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir220
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs38
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir17
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir17
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir (renamed from tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir)70
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir (renamed from tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir)36
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs (renamed from tests/mir-opt/try_identity_e2e.rs)8
-rw-r--r--tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff175
-rw-r--r--tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff38
-rw-r--r--tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff56
-rw-r--r--tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff27
-rw-r--r--tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff75
-rw-r--r--tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff23
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff475
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff536
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff472
-rw-r--r--tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff482
-rw-r--r--tests/mir-opt/reference_prop.rs592
-rw-r--r--tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff67
-rw-r--r--tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir42
-rw-r--r--tests/mir-opt/simplify_arm.rs3
-rw-r--r--tests/mir-opt/simplify_arm_identity.rs3
-rw-r--r--tests/mir-opt/slice_filter.rs2
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff16
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff258
-rw-r--r--tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff267
-rw-r--r--tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff103
-rw-r--r--tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff24
-rw-r--r--tests/mir-opt/storage_ranges.main.nll.0.mir22
-rw-r--r--tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir5
-rw-r--r--tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir17
224 files changed, 6910 insertions, 1620 deletions
diff --git a/tests/mir-opt/bool_compare.opt1.InstCombine.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
index 0af5d82d3..6c9df8f04 100644
--- a/tests/mir-opt/bool_compare.opt1.InstCombine.diff
+++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `opt1` before InstCombine
-+ // MIR for `opt1` after InstCombine
+- // MIR for `opt1` before InstSimplify
++ // MIR for `opt1` after InstSimplify
fn opt1(_1: bool) -> u32 {
debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
diff --git a/tests/mir-opt/bool_compare.opt2.InstCombine.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
index f5d1febd9..9fb398265 100644
--- a/tests/mir-opt/bool_compare.opt2.InstCombine.diff
+++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `opt2` before InstCombine
-+ // MIR for `opt2` after InstCombine
+- // MIR for `opt2` before InstSimplify
++ // MIR for `opt2` after InstSimplify
fn opt2(_1: bool) -> u32 {
debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
diff --git a/tests/mir-opt/bool_compare.opt3.InstCombine.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
index e7432adac..3a47da867 100644
--- a/tests/mir-opt/bool_compare.opt3.InstCombine.diff
+++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `opt3` before InstCombine
-+ // MIR for `opt3` after InstCombine
+- // MIR for `opt3` before InstSimplify
++ // MIR for `opt3` after InstSimplify
fn opt3(_1: bool) -> u32 {
debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
diff --git a/tests/mir-opt/bool_compare.opt4.InstCombine.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
index 6b3e27772..5319c987d 100644
--- a/tests/mir-opt/bool_compare.opt4.InstCombine.diff
+++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `opt4` before InstCombine
-+ // MIR for `opt4` after InstCombine
+- // MIR for `opt4` before InstSimplify
++ // MIR for `opt4` after InstSimplify
fn opt4(_1: bool) -> u32 {
debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10
diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs
index 4435bf5b0..080f7f72d 100644
--- a/tests/mir-opt/bool_compare.rs
+++ b/tests/mir-opt/bool_compare.rs
@@ -1,21 +1,21 @@
-// unit-test: InstCombine
+// unit-test: InstSimplify
-// EMIT_MIR bool_compare.opt1.InstCombine.diff
+// EMIT_MIR bool_compare.opt1.InstSimplify.diff
fn opt1(x: bool) -> u32 {
if x != true { 0 } else { 1 }
}
-// EMIT_MIR bool_compare.opt2.InstCombine.diff
+// EMIT_MIR bool_compare.opt2.InstSimplify.diff
fn opt2(x: bool) -> u32 {
if true != x { 0 } else { 1 }
}
-// EMIT_MIR bool_compare.opt3.InstCombine.diff
+// EMIT_MIR bool_compare.opt3.InstSimplify.diff
fn opt3(x: bool) -> u32 {
if x == false { 0 } else { 1 }
}
-// EMIT_MIR bool_compare.opt4.InstCombine.diff
+// EMIT_MIR bool_compare.opt4.InstSimplify.diff
fn opt4(x: bool) -> u32 {
if false == x { 0 } else { 1 }
}
diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
index 7cce3415f..a9d1477b9 100644
--- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
@@ -4,7 +4,7 @@
_0: GeneratorSavedTy {
ty: impl std::future::Future<Output = ()>,
source_info: SourceInfo {
- span: $DIR/async_await.rs:15:8: 15:14 (#8),
+ span: $DIR/async_await.rs:15:9: 15:14 (#8),
scope: scope[0],
},
ignore_for_traits: false,
@@ -12,7 +12,7 @@
_1: GeneratorSavedTy {
ty: impl std::future::Future<Output = ()>,
source_info: SourceInfo {
- span: $DIR/async_await.rs:16:8: 16:14 (#11),
+ span: $DIR/async_await.rs:16:9: 16:14 (#10),
scope: scope[0],
},
ignore_for_traits: false,
@@ -35,42 +35,42 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
debug _task_context => _38; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let mut _0: std::task::Poll<()>; // return place in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let _3: (); // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _4: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let mut _4: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _5: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:8
- let mut _6: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let mut _6: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _7: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let _8: (); // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _11: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _12: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let _8: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _11: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _12: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _13: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
let mut _14: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _18: !; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _21: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _21: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _22: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:8
- let mut _23: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let _24: (); // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _27: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _28: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _23: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let _24: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _27: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _28: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _29: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
let mut _30: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _34: !; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _37: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let mut _38: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let mut _39: u32; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
scope 1 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // in scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // in scope 1 at $DIR/async_await.rs:+1:9: +1:14
let _17: (); // in scope 1 at $DIR/async_await.rs:+1:5: +1:14
scope 2 {
}
@@ -79,7 +79,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
}
scope 4 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // in scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // in scope 4 at $DIR/async_await.rs:+2:9: +2:14
let _33: (); // in scope 4 at $DIR/async_await.rs:+2:5: +2:14
scope 5 {
}
@@ -96,7 +96,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb1: {
_38 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
StorageLive(_3); // scope 0 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:9: +1:14
StorageLive(_5); // scope 0 at $DIR/async_await.rs:+1:5: +1:8
_5 = a() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:5: +1:8
// mir::Constant
@@ -105,30 +105,30 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb2: {
- _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
// mir::Constant
- // + span: $DIR/async_await.rs:15:8: 15:14
+ // + span: $DIR/async_await.rs:15:9: 15:14
// + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
}
bb3: {
StorageDead(_5); // scope 0 at $DIR/async_await.rs:+1:13: +1:14
- nop; // scope 0 at $DIR/async_await.rs:+1:8: +1:14
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>) = move _4; // scope 0 at $DIR/async_await.rs:+1:8: +1:14
- goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ nop; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>) = move _4; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb4: {
- StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
// mir::Constant
- // + span: $DIR/async_await.rs:15:8: 15:14
+ // + span: $DIR/async_await.rs:15:9: 15:14
// + literal: Const { ty: unsafe fn(&mut impl Future<Output = ()>) -> Pin<&mut impl Future<Output = ()>> {Pin::<&mut impl Future<Output = ()>>::new_unchecked}, val: Value(<ZST>) }
}
@@ -136,8 +136,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_11); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
StorageLive(_13); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
StorageLive(_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _15 = _38; // scope 2 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _15 = _38; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
_14 = move _15; // scope 2 at $DIR/async_await.rs:+1:5: +1:14
goto -> bb6; // scope 2 at $DIR/async_await.rs:+1:5: +1:14
}
@@ -145,35 +145,35 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb6: {
_13 = &mut (*_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
StorageDead(_15); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:8: +1:14
+ _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
// mir::Constant
- // + span: $DIR/async_await.rs:15:8: 15:14
+ // + span: $DIR/async_await.rs:15:9: 15:14
// + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future<Output = ()>>, &'b mut Context<'c>) -> Poll<<impl Future<Output = ()> as Future>::Output> {<impl Future<Output = ()> as Future>::poll}, val: Value(<ZST>) }
}
bb7: {
StorageDead(_13); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_10); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb8: {
- _8 = const (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _8 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
StorageDead(_14); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_12); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_9); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_8); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- _20 = (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- return; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ _20 = (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ return; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb9: {
- unreachable; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ unreachable; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb10: {
@@ -190,10 +190,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb11: {
StorageDead(_20); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
StorageDead(_19); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- _7 = const (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _7 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb12: {
@@ -204,7 +204,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb13: {
StorageDead(_4); // scope 0 at $DIR/async_await.rs:+1:14: +1:15
StorageDead(_3); // scope 0 at $DIR/async_await.rs:+1:14: +1:15
- StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:9: +2:14
StorageLive(_22); // scope 0 at $DIR/async_await.rs:+2:5: +2:8
_22 = a() -> [return: bb14, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:5: +2:8
// mir::Constant
@@ -213,30 +213,30 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb14: {
- _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
// mir::Constant
- // + span: $DIR/async_await.rs:16:8: 16:14
+ // + span: $DIR/async_await.rs:16:9: 16:14
// + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
}
bb15: {
StorageDead(_22); // scope 0 at $DIR/async_await.rs:+2:13: +2:14
- nop; // scope 0 at $DIR/async_await.rs:+2:8: +2:14
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>) = move _21; // scope 0 at $DIR/async_await.rs:+2:8: +2:14
- goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ nop; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>) = move _21; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb16: {
- StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
// mir::Constant
- // + span: $DIR/async_await.rs:16:8: 16:14
+ // + span: $DIR/async_await.rs:16:9: 16:14
// + literal: Const { ty: unsafe fn(&mut impl Future<Output = ()>) -> Pin<&mut impl Future<Output = ()>> {Pin::<&mut impl Future<Output = ()>>::new_unchecked}, val: Value(<ZST>) }
}
@@ -244,8 +244,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_27); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
StorageLive(_29); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
StorageLive(_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _31 = _38; // scope 5 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _31 = _38; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
_30 = move _31; // scope 5 at $DIR/async_await.rs:+2:5: +2:14
goto -> bb18; // scope 5 at $DIR/async_await.rs:+2:5: +2:14
}
@@ -253,31 +253,31 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb18: {
_29 = &mut (*_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
StorageDead(_31); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:8: +2:14
+ _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
// mir::Constant
- // + span: $DIR/async_await.rs:16:8: 16:14
+ // + span: $DIR/async_await.rs:16:9: 16:14
// + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future<Output = ()>>, &'b mut Context<'c>) -> Poll<<impl Future<Output = ()> as Future>::Output> {<impl Future<Output = ()> as Future>::poll}, val: Value(<ZST>) }
}
bb19: {
StorageDead(_29); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_26); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb20: {
- _24 = const (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _24 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
StorageDead(_30); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_28); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_25); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_24); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- _36 = (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- return; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ _36 = (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ return; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb21: {
@@ -294,10 +294,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb22: {
StorageDead(_36); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
StorageDead(_35); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- _7 = const (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _7 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb23: {
diff --git a/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir
new file mode 100644
index 000000000..5233d0489
--- /dev/null
+++ b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir
@@ -0,0 +1,12 @@
+// MIR for `copy_for_deref` after built
+
+fn copy_for_deref(_1: (&i32, i32)) -> i32 {
+ let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:38: +0:41
+ let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _2 = deref_copy (_1.0: &i32); // scope 0 at $DIR/projections.rs:+4:13: +4:37
+ _0 = (*_2); // scope 0 at $DIR/projections.rs:+5:13: +5:24
+ return; // scope 0 at $DIR/projections.rs:+6:13: +6:21
+ }
+}
diff --git a/tests/mir-opt/building/custom/projections.rs b/tests/mir-opt/building/custom/projections.rs
index 5e472e531..3c155deae 100644
--- a/tests/mir-opt/building/custom/projections.rs
+++ b/tests/mir-opt/building/custom/projections.rs
@@ -21,13 +21,10 @@ fn unions(u: U) -> i32 {
#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
fn tuples(i: (u32, i32)) -> (u32, i32) {
mir!(
- // FIXME(JakobDegen): This is necessary because we can't give type hints for `RET`
- let temp: (u32, i32);
+ type RET = (u32, i32);
{
- temp.0 = i.0;
- temp.1 = i.1;
-
- RET = temp;
+ RET.0 = i.0;
+ RET.1 = i.1;
Return()
}
)
@@ -71,6 +68,19 @@ fn simple_index(a: [i32; 10], b: &[i32]) -> i32 {
})
}
+// EMIT_MIR projections.copy_for_deref.built.after.mir
+#[custom_mir(dialect = "runtime", phase = "initial")]
+fn copy_for_deref(x: (&i32, i32)) -> i32 {
+ mir!(
+ let temp: &i32;
+ {
+ temp = CopyForDeref(x.0);
+ RET = *temp;
+ Return()
+ }
+ )
+}
+
fn main() {
assert_eq!(unions(U { a: 5 }), 5);
assert_eq!(tuples((5, 6)), (5, 6));
@@ -82,4 +92,7 @@ fn main() {
assert_eq!(o, Some(10));
assert_eq!(simple_index([0; 10], &[0; 10]), 0);
+
+ let one = 1;
+ assert_eq!(copy_for_deref((&one, one)), 1);
}
diff --git a/tests/mir-opt/building/custom/projections.tuples.built.after.mir b/tests/mir-opt/building/custom/projections.tuples.built.after.mir
index 65487d3c9..dec575200 100644
--- a/tests/mir-opt/building/custom/projections.tuples.built.after.mir
+++ b/tests/mir-opt/building/custom/projections.tuples.built.after.mir
@@ -2,12 +2,10 @@
fn tuples(_1: (u32, i32)) -> (u32, i32) {
let mut _0: (u32, i32); // return place in scope 0 at $DIR/projections.rs:+0:29: +0:39
- let mut _2: (u32, i32); // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
bb0: {
- (_2.0: u32) = (_1.0: u32); // scope 0 at $DIR/projections.rs:+5:13: +5:25
- (_2.1: i32) = (_1.1: i32); // scope 0 at $DIR/projections.rs:+6:13: +6:25
- _0 = _2; // scope 0 at $DIR/projections.rs:+8:13: +8:23
- return; // scope 0 at $DIR/projections.rs:+9:13: +9:21
+ (_0.0: u32) = (_1.0: u32); // scope 0 at $DIR/projections.rs:+4:13: +4:24
+ (_0.1: i32) = (_1.1: i32); // scope 0 at $DIR/projections.rs:+5:13: +5:24
+ return; // scope 0 at $DIR/projections.rs:+6:13: +6:21
}
}
diff --git a/tests/mir-opt/building/enum_cast.bar.built.after.mir b/tests/mir-opt/building/enum_cast.bar.built.after.mir
index 0746e0b49..9f14c0284 100644
--- a/tests/mir-opt/building/enum_cast.bar.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.bar.built.after.mir
@@ -5,17 +5,16 @@ fn bar(_1: Bar) -> usize {
let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
let _2: Bar; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _4: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
bb0: {
StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
_2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
_3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _4 = Ge(const 1_isize, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(_4); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _5 = Le(const 0_isize, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(_5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _5 = Le(_4, const 1_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
diff --git a/tests/mir-opt/building/enum_cast.boo.built.after.mir b/tests/mir-opt/building/enum_cast.boo.built.after.mir
index 699c876b0..715dedcf2 100644
--- a/tests/mir-opt/building/enum_cast.boo.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.boo.built.after.mir
@@ -5,17 +5,16 @@ fn boo(_1: Boo) -> usize {
let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
let _2: Boo; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
let mut _3: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
- let mut _4: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
bb0: {
StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
_2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
_3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _4 = Ge(const 1_u8, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(_4); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- _5 = Le(const 0_u8, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
- assume(_5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _5 = Le(_4, const 1_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
_0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
diff --git a/tests/mir-opt/building/enum_cast.droppy.built.after.mir b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
index 1112177fb..6c177c61e 100644
--- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
@@ -6,7 +6,7 @@ fn droppy() -> () {
let _2: Droppy; // in scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
let _4: Droppy; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18
let mut _5: isize; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18
- let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
+ let mut _6: u8; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
let _8: Droppy; // in scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
scope 1 {
@@ -31,10 +31,9 @@ fn droppy() -> () {
StorageLive(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18
_4 = move _2; // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18
_5 = discriminant(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- _6 = Ge(const 2_isize, _5); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- assume(_6); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- _7 = Le(const 0_isize, _5); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
- assume(_7); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ _6 = _5 as u8 (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ _7 = Le(_6, const 2_u8); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ assume(move _7); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
_3 = move _5 as usize (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
drop(_4) -> [return: bb1, unwind: bb4]; // scope 3 at $DIR/enum_cast.rs:+5:26: +5:27
}
diff --git a/tests/mir-opt/building/enum_cast.far.built.after.mir b/tests/mir-opt/building/enum_cast.far.built.after.mir
new file mode 100644
index 000000000..ab8129ca0
--- /dev/null
+++ b/tests/mir-opt/building/enum_cast.far.built.after.mir
@@ -0,0 +1,22 @@
+// MIR for `far` after built
+
+fn far(_1: Far) -> isize {
+ debug far => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
+ let mut _0: isize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
+ let _2: Far; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _3: i16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _4: u16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _4 = _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _5 = Le(_4, const 1_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _0 = move _3 as isize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
+ return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir
new file mode 100644
index 000000000..7b2b583f2
--- /dev/null
+++ b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir
@@ -0,0 +1,26 @@
+// MIR for `offsetty` after built
+
+fn offsetty(_1: NotStartingAtZero) -> u32 {
+ debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:13: +0:14
+ let mut _0: u32; // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41
+ let _2: NotStartingAtZero; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _5 = Ge(_4, const 4_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _6 = Le(_4, const 8_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _7 = BitAnd(move _5, move _6); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ assume(move _7); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _0 = move _3 as u32 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:12: +1:13
+ return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs
index 98fd5acfb..431b5c708 100644
--- a/tests/mir-opt/building/enum_cast.rs
+++ b/tests/mir-opt/building/enum_cast.rs
@@ -1,6 +1,7 @@
// EMIT_MIR enum_cast.foo.built.after.mir
// EMIT_MIR enum_cast.bar.built.after.mir
// EMIT_MIR enum_cast.boo.built.after.mir
+// EMIT_MIR enum_cast.far.built.after.mir
enum Foo {
A
@@ -15,6 +16,11 @@ enum Boo {
A, B
}
+#[repr(i16)]
+enum Far {
+ A, B
+}
+
fn foo(foo: Foo) -> usize {
foo as usize
}
@@ -27,6 +33,10 @@ fn boo(boo: Boo) -> usize {
boo as usize
}
+fn far(far: Far) -> isize {
+ far as isize
+}
+
// EMIT_MIR enum_cast.droppy.built.after.mir
enum Droppy {
A, B, C
@@ -46,5 +56,37 @@ fn droppy() {
let z = Droppy::B;
}
+#[repr(i16)]
+enum SignedAroundZero {
+ A = -2,
+ B = 0,
+ C = 2,
+}
+
+#[repr(u16)]
+enum UnsignedAroundZero {
+ A = 65535,
+ B = 0,
+ C = 1,
+}
+
+// EMIT_MIR enum_cast.signy.built.after.mir
+fn signy(x: SignedAroundZero) -> i16 {
+ x as i16
+}
+
+// EMIT_MIR enum_cast.unsigny.built.after.mir
+fn unsigny(x: UnsignedAroundZero) -> u16 {
+ // FIXME: This doesn't get an around-the-end range today, sadly.
+ x as u16
+}
+
+enum NotStartingAtZero { A = 4, B = 6, C = 8 }
+
+// EMIT_MIR enum_cast.offsetty.built.after.mir
+fn offsetty(x: NotStartingAtZero) -> u32 {
+ x as u32
+}
+
fn main() {
}
diff --git a/tests/mir-opt/building/enum_cast.signy.built.after.mir b/tests/mir-opt/building/enum_cast.signy.built.after.mir
new file mode 100644
index 000000000..ef4fea604
--- /dev/null
+++ b/tests/mir-opt/building/enum_cast.signy.built.after.mir
@@ -0,0 +1,26 @@
+// MIR for `signy` after built
+
+fn signy(_1: SignedAroundZero) -> i16 {
+ debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:10: +0:11
+ let mut _0: i16; // return place in scope 0 at $DIR/enum_cast.rs:+0:34: +0:37
+ let _2: SignedAroundZero; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ let mut _3: i16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ let mut _4: u16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _4 = _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _5 = Ge(_4, const 65534_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _6 = Le(_4, const 2_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _7 = BitOr(move _5, move _6); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ assume(move _7); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ _0 = move _3 as i16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:12: +1:13
+ return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/building/enum_cast.unsigny.built.after.mir b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
new file mode 100644
index 000000000..7ca147b15
--- /dev/null
+++ b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir
@@ -0,0 +1,17 @@
+// MIR for `unsigny` after built
+
+fn unsigny(_1: UnsignedAroundZero) -> u16 {
+ debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:12: +0:13
+ let mut _0: u16; // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41
+ let _2: UnsignedAroundZero; // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+ let mut _3: u16; // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13
+ _0 = move _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+2:12: +2:13
+ return; // scope 0 at $DIR/enum_cast.rs:+3:2: +3:2
+ }
+}
diff --git a/tests/mir-opt/casts.redundant.InstCombine.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff
index 528a8e5a9..a641b69de 100644
--- a/tests/mir-opt/casts.redundant.InstCombine.diff
+++ b/tests/mir-opt/casts.redundant.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `redundant` before InstCombine
-+ // MIR for `redundant` after InstCombine
+- // MIR for `redundant` before InstSimplify
++ // MIR for `redundant` after InstSimplify
fn redundant(_1: *const &u8) -> *const &u8 {
debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31
diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs
index 259c462da..413b0e09d 100644
--- a/tests/mir-opt/casts.rs
+++ b/tests/mir-opt/casts.rs
@@ -1,6 +1,6 @@
#![crate_type = "lib"]
-// EMIT_MIR casts.redundant.InstCombine.diff
+// 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
diff --git a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff
index c73150f94..0777007ce 100644
--- a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff
+++ b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `norm2` before InstCombine
-+ // MIR for `norm2` after InstCombine
+- // MIR for `norm2` before InstSimplify
++ // MIR for `norm2` after InstSimplify
fn norm2(_1: [f32; 2]) -> f32 {
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11
diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/combine_array_len.rs
index 08c5f1a1f..970cafafc 100644
--- a/tests/mir-opt/combine_array_len.rs
+++ b/tests/mir-opt/combine_array_len.rs
@@ -1,6 +1,6 @@
// ignore-wasm32 compiled with panic=abort by default
-// unit-test: InstCombine
-// EMIT_MIR combine_array_len.norm2.InstCombine.diff
+// unit-test: InstSimplify
+// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
fn norm2(x: [f32; 2]) -> f32 {
let a = x[0];
diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/combine_clone_of_primitives.rs
index 7cc50a86e..1deee9dd6 100644
--- a/tests/mir-opt/combine_clone_of_primitives.rs
+++ b/tests/mir-opt/combine_clone_of_primitives.rs
@@ -1,7 +1,7 @@
-// unit-test: InstCombine
+// unit-test: InstSimplify
// ignore-wasm32 compiled with panic=abort by default
-// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff
+// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
#[derive(Clone)]
struct MyThing<T> {
diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
index b715a544f..bb0811a7a 100644
--- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff
+++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` before InstCombine
-+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` after InstCombine
+- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` before InstSimplify
++ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone` after InstSimplify
fn <impl at $DIR/combine_clone_of_primitives.rs:6:10: 6:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15
diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff
deleted file mode 100644
index 168e8c610..000000000
--- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff
+++ /dev/null
@@ -1,158 +0,0 @@
-- // MIR for `adt_transmutes` before InstCombine
-+ // MIR for `adt_transmutes` after InstCombine
-
- fn adt_transmutes() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32
- let _1: u8; // in scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11
- let mut _2: EnumNoRepr; // in scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:41
- let mut _4: EnumNoRepr; // in scope 0 at $DIR/combine_transmutes.rs:+2:28: +2:41
- let mut _6: EnumReprIsize; // in scope 0 at $DIR/combine_transmutes.rs:+3:31: +3:47
- let mut _8: EnumReprIsize; // in scope 0 at $DIR/combine_transmutes.rs:+4:31: +4:47
- let mut _10: std::cmp::Ordering; // in scope 0 at $DIR/combine_transmutes.rs:+5:28: +5:52
- let mut _12: std::cmp::Ordering; // in scope 0 at $DIR/combine_transmutes.rs:+6:28: +6:52
- let mut _14: std::option::Option<std::num::NonZeroU8>; // in scope 0 at $DIR/combine_transmutes.rs:+7:28: +7:58
- let mut _16: std::num::Wrapping<i16>; // in scope 0 at $DIR/combine_transmutes.rs:+8:29: +8:54
- let mut _18: std::num::Wrapping<i16>; // in scope 0 at $DIR/combine_transmutes.rs:+9:29: +9:54
- let mut _20: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+10:29: +10:47
- let mut _22: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+11:29: +11:47
- let mut _24: std::mem::MaybeUninit<std::string::String>; // in scope 0 at $DIR/combine_transmutes.rs:+12:46: +12:77
- scope 1 {
- debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+1:9: +1:11
- let _3: i8; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
- scope 2 {
- debug _a => _3; // in scope 2 at $DIR/combine_transmutes.rs:+2:9: +2:11
- let _5: usize; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
- scope 3 {
- debug _a => _5; // in scope 3 at $DIR/combine_transmutes.rs:+3:9: +3:11
- let _7: isize; // in scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11
- scope 4 {
- debug _a => _7; // in scope 4 at $DIR/combine_transmutes.rs:+4:9: +4:11
- let _9: u8; // in scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11
- scope 5 {
- debug _a => _9; // in scope 5 at $DIR/combine_transmutes.rs:+5:9: +5:11
- let _11: i8; // in scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11
- scope 6 {
- debug _a => _11; // in scope 6 at $DIR/combine_transmutes.rs:+6:9: +6:11
- let _13: u8; // in scope 6 at $DIR/combine_transmutes.rs:+7:9: +7:11
- scope 7 {
- debug _a => _13; // in scope 7 at $DIR/combine_transmutes.rs:+7:9: +7:11
- let _15: i16; // in scope 7 at $DIR/combine_transmutes.rs:+8:9: +8:11
- scope 8 {
- debug _a => _15; // in scope 8 at $DIR/combine_transmutes.rs:+8:9: +8:11
- let _17: u16; // in scope 8 at $DIR/combine_transmutes.rs:+9:9: +9:11
- scope 9 {
- debug _a => _17; // in scope 9 at $DIR/combine_transmutes.rs:+9:9: +9:11
- let _19: u32; // in scope 9 at $DIR/combine_transmutes.rs:+10:9: +10:11
- scope 10 {
- debug _a => _19; // in scope 10 at $DIR/combine_transmutes.rs:+10:9: +10:11
- let _21: i32; // in scope 10 at $DIR/combine_transmutes.rs:+11:9: +11:11
- scope 11 {
- debug _a => _21; // in scope 11 at $DIR/combine_transmutes.rs:+11:9: +11:11
- let _23: std::mem::ManuallyDrop<std::string::String>; // in scope 11 at $DIR/combine_transmutes.rs:+12:9: +12:11
- scope 12 {
- debug _a => _23; // in scope 12 at $DIR/combine_transmutes.rs:+12:9: +12:11
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11
- StorageLive(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:41
- _2 = EnumNoRepr::A; // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:41
- _1 = move _2 as u8 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+1:18: +1:42
- StorageDead(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:41: +1:42
- StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
- StorageLive(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:28: +2:41
- _4 = EnumNoRepr::B; // scope 1 at $DIR/combine_transmutes.rs:+2:28: +2:41
- _3 = move _4 as i8 (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+2:18: +2:42
- StorageDead(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:41: +2:42
- StorageLive(_5); // scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
- StorageLive(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:31: +3:47
- _6 = EnumReprIsize::A; // scope 2 at $DIR/combine_transmutes.rs:+3:31: +3:47
- _5 = move _6 as usize (Transmute); // scope 2 at $DIR/combine_transmutes.rs:+3:21: +3:48
- StorageDead(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:47: +3:48
- StorageLive(_7); // scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11
- StorageLive(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:31: +4:47
- _8 = EnumReprIsize::B; // scope 3 at $DIR/combine_transmutes.rs:+4:31: +4:47
-- _7 = move _8 as isize (Transmute); // scope 3 at $DIR/combine_transmutes.rs:+4:21: +4:48
-+ _7 = discriminant(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:21: +4:48
- StorageDead(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:47: +4:48
- StorageLive(_9); // scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11
- StorageLive(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:28: +5:52
- _10 = Less; // scope 4 at $DIR/combine_transmutes.rs:+5:28: +5:52
- _9 = move _10 as u8 (Transmute); // scope 4 at $DIR/combine_transmutes.rs:+5:18: +5:53
- StorageDead(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:52: +5:53
- StorageLive(_11); // scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11
- StorageLive(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:28: +6:52
- _12 = Less; // scope 5 at $DIR/combine_transmutes.rs:+6:28: +6:52
-- _11 = move _12 as i8 (Transmute); // scope 5 at $DIR/combine_transmutes.rs:+6:18: +6:53
-+ _11 = discriminant(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:18: +6:53
- StorageDead(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:52: +6:53
- StorageLive(_13); // scope 6 at $DIR/combine_transmutes.rs:+7:9: +7:11
- StorageLive(_14); // scope 6 at $DIR/combine_transmutes.rs:+7:28: +7:58
- _14 = Option::<NonZeroU8>::Some(const _); // scope 6 at $DIR/combine_transmutes.rs:+7:28: +7:58
- // mir::Constant
- // + span: $DIR/combine_transmutes.rs:41:33: 41:57
- // + literal: Const { ty: NonZeroU8, val: Unevaluated(NonZeroU8::MAX, [], None) }
- _13 = move _14 as u8 (Transmute); // scope 6 at $DIR/combine_transmutes.rs:+7:18: +7:59
- StorageDead(_14); // scope 6 at $DIR/combine_transmutes.rs:+7:58: +7:59
- StorageLive(_15); // scope 7 at $DIR/combine_transmutes.rs:+8:9: +8:11
- StorageLive(_16); // scope 7 at $DIR/combine_transmutes.rs:+8:29: +8:54
- _16 = Wrapping::<i16>(const 0_i16); // scope 7 at $DIR/combine_transmutes.rs:+8:29: +8:54
-- _15 = move _16 as i16 (Transmute); // scope 7 at $DIR/combine_transmutes.rs:+8:19: +8:55
-+ _15 = move (_16.0: i16); // scope 7 at $DIR/combine_transmutes.rs:+8:19: +8:55
- StorageDead(_16); // scope 7 at $DIR/combine_transmutes.rs:+8:54: +8:55
- StorageLive(_17); // scope 8 at $DIR/combine_transmutes.rs:+9:9: +9:11
- StorageLive(_18); // scope 8 at $DIR/combine_transmutes.rs:+9:29: +9:54
- _18 = Wrapping::<i16>(const 0_i16); // scope 8 at $DIR/combine_transmutes.rs:+9:29: +9:54
- _17 = move _18 as u16 (Transmute); // scope 8 at $DIR/combine_transmutes.rs:+9:19: +9:55
- StorageDead(_18); // scope 8 at $DIR/combine_transmutes.rs:+9:54: +9:55
- StorageLive(_19); // scope 9 at $DIR/combine_transmutes.rs:+10:9: +10:11
- StorageLive(_20); // scope 9 at $DIR/combine_transmutes.rs:+10:29: +10:47
- _20 = Union32 { u32: const 0_i32 }; // scope 9 at $DIR/combine_transmutes.rs:+10:29: +10:47
- _19 = move _20 as u32 (Transmute); // scope 9 at $DIR/combine_transmutes.rs:+10:19: +10:48
- StorageDead(_20); // scope 9 at $DIR/combine_transmutes.rs:+10:47: +10:48
- StorageLive(_21); // scope 10 at $DIR/combine_transmutes.rs:+11:9: +11:11
- StorageLive(_22); // scope 10 at $DIR/combine_transmutes.rs:+11:29: +11:47
- _22 = Union32 { u32: const 0_u32 }; // scope 10 at $DIR/combine_transmutes.rs:+11:29: +11:47
- _21 = move _22 as i32 (Transmute); // scope 10 at $DIR/combine_transmutes.rs:+11:19: +11:48
- StorageDead(_22); // scope 10 at $DIR/combine_transmutes.rs:+11:47: +11:48
- StorageLive(_23); // scope 11 at $DIR/combine_transmutes.rs:+12:9: +12:11
- StorageLive(_24); // scope 11 at $DIR/combine_transmutes.rs:+12:46: +12:77
- _24 = MaybeUninit::<String>::uninit() -> [return: bb1, unwind unreachable]; // scope 11 at $DIR/combine_transmutes.rs:+12:46: +12:77
- // mir::Constant
- // + span: $DIR/combine_transmutes.rs:46:46: 46:75
- // + user_ty: UserType(23)
- // + literal: Const { ty: fn() -> MaybeUninit<String> {MaybeUninit::<String>::uninit}, val: Value(<ZST>) }
- }
-
- bb1: {
-- _23 = move _24 as std::mem::ManuallyDrop<std::string::String> (Transmute); // scope 11 at $DIR/combine_transmutes.rs:+12:36: +12:78
-+ _23 = move (_24.1: std::mem::ManuallyDrop<std::string::String>); // scope 11 at $DIR/combine_transmutes.rs:+12:36: +12:78
- StorageDead(_24); // scope 11 at $DIR/combine_transmutes.rs:+12:77: +12:78
- _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:32: +13:2
- StorageDead(_23); // scope 11 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_21); // scope 10 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_19); // scope 9 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_17); // scope 8 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_15); // scope 7 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_13); // scope 6 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_11); // scope 5 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_9); // scope 4 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_7); // scope 3 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_5); // scope 2 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+13:1: +13:2
- StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+13:1: +13:2
- return; // scope 0 at $DIR/combine_transmutes.rs:+13:2: +13:2
- }
- }
-
diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff
new file mode 100644
index 000000000..15117ea89
--- /dev/null
+++ b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff
@@ -0,0 +1,90 @@
+- // MIR for `adt_transmutes` before InstSimplify
++ // MIR for `adt_transmutes` after InstSimplify
+
+ fn adt_transmutes() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32
+ let _1: u8; // in scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11
+ let mut _2: std::option::Option<std::num::NonZeroU8>; // in scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58
+ let mut _4: std::num::Wrapping<i16>; // in scope 0 at $DIR/combine_transmutes.rs:+2:29: +2:54
+ let mut _6: std::num::Wrapping<i16>; // in scope 0 at $DIR/combine_transmutes.rs:+3:29: +3:54
+ let mut _8: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+4:29: +4:47
+ let mut _10: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+5:29: +5:47
+ let mut _12: std::mem::MaybeUninit<std::string::String>; // in scope 0 at $DIR/combine_transmutes.rs:+6:46: +6:77
+ scope 1 {
+ debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+1:9: +1:11
+ let _3: i16; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
+ scope 2 {
+ debug _a => _3; // in scope 2 at $DIR/combine_transmutes.rs:+2:9: +2:11
+ let _5: u16; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
+ scope 3 {
+ debug _a => _5; // in scope 3 at $DIR/combine_transmutes.rs:+3:9: +3:11
+ let _7: u32; // in scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11
+ scope 4 {
+ debug _a => _7; // in scope 4 at $DIR/combine_transmutes.rs:+4:9: +4:11
+ let _9: i32; // in scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11
+ scope 5 {
+ debug _a => _9; // in scope 5 at $DIR/combine_transmutes.rs:+5:9: +5:11
+ let _11: std::mem::ManuallyDrop<std::string::String>; // in scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11
+ scope 6 {
+ debug _a => _11; // in scope 6 at $DIR/combine_transmutes.rs:+6:9: +6:11
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11
+ StorageLive(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58
+ _2 = Option::<NonZeroU8>::Some(const _); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58
+ // mir::Constant
+ // + span: $DIR/combine_transmutes.rs:35:33: 35:57
+ // + literal: Const { ty: NonZeroU8, val: Unevaluated(NonZeroU8::MAX, [], None) }
+ _1 = move _2 as u8 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+1:18: +1:59
+ StorageDead(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:58: +1:59
+ StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11
+ StorageLive(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:29: +2:54
+ _4 = Wrapping::<i16>(const 0_i16); // scope 1 at $DIR/combine_transmutes.rs:+2:29: +2:54
+- _3 = move _4 as i16 (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+2:19: +2:55
++ _3 = move (_4.0: i16); // scope 1 at $DIR/combine_transmutes.rs:+2:19: +2:55
+ StorageDead(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:54: +2:55
+ StorageLive(_5); // scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11
+ StorageLive(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:29: +3:54
+ _6 = Wrapping::<i16>(const 0_i16); // scope 2 at $DIR/combine_transmutes.rs:+3:29: +3:54
+ _5 = move _6 as u16 (Transmute); // scope 2 at $DIR/combine_transmutes.rs:+3:19: +3:55
+ StorageDead(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:54: +3:55
+ StorageLive(_7); // scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11
+ StorageLive(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:29: +4:47
+ _8 = Union32 { u32: const 0_i32 }; // scope 3 at $DIR/combine_transmutes.rs:+4:29: +4:47
+ _7 = move _8 as u32 (Transmute); // scope 3 at $DIR/combine_transmutes.rs:+4:19: +4:48
+ StorageDead(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:47: +4:48
+ StorageLive(_9); // scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11
+ StorageLive(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:29: +5:47
+ _10 = Union32 { u32: const 0_u32 }; // scope 4 at $DIR/combine_transmutes.rs:+5:29: +5:47
+ _9 = move _10 as i32 (Transmute); // scope 4 at $DIR/combine_transmutes.rs:+5:19: +5:48
+ StorageDead(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:47: +5:48
+ StorageLive(_11); // scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11
+ StorageLive(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:46: +6:77
+ _12 = MaybeUninit::<String>::uninit() -> [return: bb1, unwind unreachable]; // scope 5 at $DIR/combine_transmutes.rs:+6:46: +6:77
+ // mir::Constant
+ // + span: $DIR/combine_transmutes.rs:40:46: 40:75
+ // + user_ty: UserType(11)
+ // + literal: Const { ty: fn() -> MaybeUninit<String> {MaybeUninit::<String>::uninit}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+- _11 = move _12 as std::mem::ManuallyDrop<std::string::String> (Transmute); // scope 5 at $DIR/combine_transmutes.rs:+6:36: +6:78
++ _11 = move (_12.1: std::mem::ManuallyDrop<std::string::String>); // scope 5 at $DIR/combine_transmutes.rs:+6:36: +6:78
+ StorageDead(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:77: +6:78
+ _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:32: +7:2
+ StorageDead(_11); // scope 5 at $DIR/combine_transmutes.rs:+7:1: +7:2
+ StorageDead(_9); // scope 4 at $DIR/combine_transmutes.rs:+7:1: +7:2
+ StorageDead(_7); // scope 3 at $DIR/combine_transmutes.rs:+7:1: +7:2
+ StorageDead(_5); // scope 2 at $DIR/combine_transmutes.rs:+7:1: +7:2
+ StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+7:1: +7:2
+ StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+7:1: +7:2
+ return; // scope 0 at $DIR/combine_transmutes.rs:+7:2: +7:2
+ }
+ }
+
diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff
index ae1185c7f..57d9f4b14 100644
--- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff
+++ b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `identity_transmutes` before InstCombine
-+ // MIR for `identity_transmutes` after InstCombine
+- // MIR for `identity_transmutes` before InstSimplify
++ // MIR for `identity_transmutes` after InstSimplify
fn identity_transmutes() -> () {
let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:37: +0:37
diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff
index 8de7c34e6..ec7c982c1 100644
--- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff
+++ b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `integer_transmutes` before InstCombine
-+ // MIR for `integer_transmutes` after InstCombine
+- // MIR for `integer_transmutes` before InstSimplify
++ // MIR for `integer_transmutes` after InstSimplify
fn integer_transmutes() -> () {
let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:36: +0:36
diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/combine_transmutes.rs
index de9b9c35c..403f9356c 100644
--- a/tests/mir-opt/combine_transmutes.rs
+++ b/tests/mir-opt/combine_transmutes.rs
@@ -1,4 +1,4 @@
-// unit-test: InstCombine
+// unit-test: InstSimplify
// compile-flags: -C panic=abort
#![crate_type = "lib"]
@@ -8,7 +8,7 @@
use std::intrinsics::mir::*;
use std::mem::{MaybeUninit, ManuallyDrop, transmute};
-// EMIT_MIR combine_transmutes.identity_transmutes.InstCombine.diff
+// 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);
@@ -16,7 +16,7 @@ pub unsafe fn identity_transmutes() {
}
#[custom_mir(dialect = "runtime", phase = "initial")]
-// EMIT_MIR combine_transmutes.integer_transmutes.InstCombine.diff
+// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff
pub unsafe fn integer_transmutes() {
mir! {
{
@@ -30,14 +30,8 @@ pub unsafe fn integer_transmutes() {
}
}
-// EMIT_MIR combine_transmutes.adt_transmutes.InstCombine.diff
+// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff
pub unsafe fn adt_transmutes() {
- let _a: u8 = transmute(EnumNoRepr::A);
- let _a: i8 = transmute(EnumNoRepr::B);
- let _a: usize = transmute(EnumReprIsize::A);
- let _a: isize = transmute(EnumReprIsize::B);
- let _a: u8 = transmute(std::cmp::Ordering::Less);
- let _a: i8 = transmute(std::cmp::Ordering::Less);
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));
@@ -46,20 +40,4 @@ pub unsafe fn adt_transmutes() {
let _a: ManuallyDrop<String> = transmute(MaybeUninit::<String>::uninit());
}
-#[inline(always)]
-#[custom_mir(dialect = "runtime", phase = "initial")]
-const unsafe fn mir_transmute<T, U>(x: T) -> U {
- mir!{
- {
- RET = CastTransmute(x);
- Return()
- }
- }
-}
-
-pub enum EnumNoRepr { A, B, C }
-
-#[repr(isize)]
-pub enum EnumReprIsize { A, B, C }
-
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 9b69f79c2..169e99dee 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir
@@ -21,42 +21,42 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc18─╼ 03 00 00 00 │ ╾──╼....
+ ╾─alloc19─╼ 03 00 00 00 │ ╾──╼....
}
-alloc18 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc5──╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc13─╼ 03 00 00 00 │ ....*...╾──╼....
+alloc19 (size: 48, align: 4) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc6──╼ 00 00 00 00 │ ....░░░░╾──╼....
+ 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 02 00 00 00 │ ....░░░░╾──╼....
+ 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ....*...╾──╼....
}
-alloc5 (size: 0, align: 4) {}
+alloc6 (size: 0, align: 4) {}
-alloc8 (size: 16, align: 4) {
- ╾─alloc9──╼ 03 00 00 00 ╾─alloc10─╼ 03 00 00 00 │ ╾──╼....╾──╼....
+alloc9 (size: 16, align: 4) {
+ ╾─alloc10─╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼....
}
-alloc9 (size: 3, align: 1) {
+alloc10 (size: 3, align: 1) {
66 6f 6f │ foo
}
-alloc10 (size: 3, align: 1) {
+alloc11 (size: 3, align: 1) {
62 61 72 │ bar
}
-alloc13 (size: 24, align: 4) {
- 0x00 │ ╾─alloc14─╼ 03 00 00 00 ╾─alloc15─╼ 03 00 00 00 │ ╾──╼....╾──╼....
- 0x10 │ ╾─alloc16─╼ 04 00 00 00 │ ╾──╼....
+alloc14 (size: 24, align: 4) {
+ 0x00 │ ╾─alloc15─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼....
+ 0x10 │ ╾─alloc17─╼ 04 00 00 00 │ ╾──╼....
}
-alloc14 (size: 3, align: 1) {
+alloc15 (size: 3, align: 1) {
6d 65 68 │ meh
}
-alloc15 (size: 3, align: 1) {
+alloc16 (size: 3, align: 1) {
6d 6f 70 │ mop
}
-alloc16 (size: 4, align: 1) {
+alloc17 (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 d0f196e72..db1f96488 100644
--- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir
@@ -21,46 +21,46 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc18───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ ╾───────alloc19───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc18 (size: 72, align: 8) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc5────────╼ │ ....░░░░╾──────╼
+alloc19 (size: 72, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc6────────╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc8────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc13───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾───────alloc9────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc14───────╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc5 (size: 0, align: 8) {}
+alloc6 (size: 0, align: 8) {}
-alloc8 (size: 32, align: 8) {
- 0x00 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x10 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+alloc9 (size: 32, align: 8) {
+ 0x00 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾───────alloc11───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc9 (size: 3, align: 1) {
+alloc10 (size: 3, align: 1) {
66 6f 6f │ foo
}
-alloc10 (size: 3, align: 1) {
+alloc11 (size: 3, align: 1) {
62 61 72 │ bar
}
-alloc13 (size: 48, align: 8) {
- 0x00 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x10 │ ╾───────alloc15───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x20 │ ╾───────alloc16───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+alloc14 (size: 48, align: 8) {
+ 0x00 │ ╾───────alloc15───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x10 │ ╾───────alloc16───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x20 │ ╾───────alloc17───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc14 (size: 3, align: 1) {
+alloc15 (size: 3, align: 1) {
6d 65 68 │ meh
}
-alloc15 (size: 3, align: 1) {
+alloc16 (size: 3, align: 1) {
6d 6f 70 │ mop
}
-alloc16 (size: 4, align: 1) {
+alloc17 (size: 4, align: 1) {
6d c3 b6 70 │ m..p
}
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 aab005c52..999acb48a 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir
@@ -21,41 +21,41 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 8, align: 4) {
- ╾─alloc22─╼ 03 00 00 00 │ ╾──╼....
+ ╾─alloc23─╼ 03 00 00 00 │ ╾──╼....
}
-alloc22 (size: 48, align: 4) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 00 00 00 00 │ ....░░░░╾──╼....
- 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc14─╼ 02 00 00 00 │ ....░░░░╾──╼....
- 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc20─╼ 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 │ ....*...╾──╼....
}
-alloc9 (size: 0, align: 4) {}
+alloc10 (size: 0, align: 4) {}
-alloc14 (size: 8, align: 4) {
- ╾─alloc12─╼ ╾─alloc13─╼ │ ╾──╼╾──╼
+alloc15 (size: 8, align: 4) {
+ ╾─alloc13─╼ ╾─alloc14─╼ │ ╾──╼╾──╼
}
-alloc12 (size: 1, align: 1) {
+alloc13 (size: 1, align: 1) {
05 │ .
}
-alloc13 (size: 1, align: 1) {
+alloc14 (size: 1, align: 1) {
06 │ .
}
-alloc20 (size: 12, align: 4) {
- ╾─a17+0x3─╼ ╾─alloc18─╼ ╾─a19+0x2─╼ │ ╾──╼╾──╼╾──╼
+alloc21 (size: 12, align: 4) {
+ ╾─a18+0x3─╼ ╾─alloc19─╼ ╾─a20+0x2─╼ │ ╾──╼╾──╼╾──╼
}
-alloc17 (size: 4, align: 1) {
+alloc18 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
-alloc18 (size: 1, align: 1) {
+alloc19 (size: 1, align: 1) {
2a │ *
}
-alloc19 (size: 4, align: 1) {
+alloc20 (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 0eff9474c..30311890e 100644
--- a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir
@@ -21,44 +21,44 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 16, align: 8) {
- ╾───────alloc22───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
+ ╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
}
-alloc22 (size: 72, align: 8) {
- 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc9────────╼ │ ....░░░░╾──────╼
+alloc23 (size: 72, align: 8) {
+ 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc10───────╼ │ ....░░░░╾──────╼
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
- 0x20 │ ╾───────alloc14───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
- 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc20───────╼ │ ....*...╾──────╼
+ 0x20 │ ╾───────alloc15───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
+ 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc21───────╼ │ ....*...╾──────╼
0x40 │ 03 00 00 00 00 00 00 00 │ ........
}
-alloc9 (size: 0, align: 8) {}
+alloc10 (size: 0, align: 8) {}
-alloc14 (size: 16, align: 8) {
- ╾───────alloc12───────╼ ╾───────alloc13───────╼ │ ╾──────╼╾──────╼
+alloc15 (size: 16, align: 8) {
+ ╾───────alloc13───────╼ ╾───────alloc14───────╼ │ ╾──────╼╾──────╼
}
-alloc12 (size: 1, align: 1) {
+alloc13 (size: 1, align: 1) {
05 │ .
}
-alloc13 (size: 1, align: 1) {
+alloc14 (size: 1, align: 1) {
06 │ .
}
-alloc20 (size: 24, align: 8) {
- 0x00 │ ╾─────alloc17+0x3─────╼ ╾───────alloc18───────╼ │ ╾──────╼╾──────╼
- 0x10 │ ╾─────alloc19+0x2─────╼ │ ╾──────╼
+alloc21 (size: 24, align: 8) {
+ 0x00 │ ╾─────alloc18+0x3─────╼ ╾───────alloc19───────╼ │ ╾──────╼╾──────╼
+ 0x10 │ ╾─────alloc20+0x2─────╼ │ ╾──────╼
}
-alloc17 (size: 4, align: 1) {
+alloc18 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
-alloc18 (size: 1, align: 1) {
+alloc19 (size: 1, align: 1) {
2a │ *
}
-alloc19 (size: 4, align: 1) {
+alloc20 (size: 4, align: 1) {
2a 45 15 6f │ *E.o
}
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 55c6db5d0..d592e59fa 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir
@@ -21,30 +21,30 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 4, align: 4) {
- ╾─alloc11─╼ │ ╾──╼
+ ╾─alloc12─╼ │ ╾──╼
}
-alloc11 (size: 168, align: 1) {
+alloc12 (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 ╾─alloc6──╼ │ ............╾──╼
+ 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc7──╼ │ ............╾──╼
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 ╾─alloc8──╼ 00 00 │ ..........╾──╼..
- 0x90 │ ╾─a9+0x63─╼ 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 │ ╾──╼............
0xa0 │ 00 00 00 00 00 00 00 00 │ ........
}
-alloc6 (size: 4, align: 4) {
+alloc7 (size: 4, align: 4) {
2a 00 00 00 │ *...
}
-alloc8 (fn: main)
+alloc9 (fn: main)
-alloc9 (size: 100, align: 1) {
+alloc10 (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 27492a7fd..ca53b28be 100644
--- a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
+++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir
@@ -21,12 +21,12 @@ fn main() -> () {
}
alloc1 (static: FOO, size: 8, align: 8) {
- ╾───────alloc11───────╼ │ ╾──────╼
+ ╾───────alloc12───────╼ │ ╾──────╼
}
-alloc11 (size: 180, align: 1) {
+alloc12 (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 ╾──alloc6── │ ............╾───
+ 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc7── │ ............╾───
0x20 │ ──────────╼ 01 ef cd ab 00 00 00 00 00 00 00 00 │ ───╼............
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
@@ -34,18 +34,18 @@ alloc11 (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 │ ─────alloc8─────╼ 00 00 ╾─────alloc9+0x63─────╼ │ ─────╼..╾──────╼
+ 0x90 │ ─────alloc9─────╼ 00 00 ╾────alloc10+0x63─────╼ │ ─────╼..╾──────╼
0xa0 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
0xb0 │ 00 00 00 00 │ ....
}
-alloc6 (size: 4, align: 4) {
+alloc7 (size: 4, align: 4) {
2a 00 00 00 │ *...
}
-alloc8 (fn: main)
+alloc9 (fn: main)
-alloc9 (size: 100, align: 1) {
+alloc10 (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_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 19daae865..41657b53f 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,10 +7,10 @@ promoted[0] in FOO: &[&i32; 1] = {
let mut _3: *const i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
bb0: {
- _3 = const {alloc2: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
+ _3 = const {alloc3: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
// mir::Constant
// + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
+ // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
_2 = &(*_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43
_1 = [move _2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
_0 = &_1; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
@@ -18,4 +18,4 @@ promoted[0] in FOO: &[&i32; 1] = {
}
}
-alloc2 (extern static: X)
+alloc3 (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 5b13d6005..25ba0face 100644
--- a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
+++ b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff
@@ -18,11 +18,11 @@
- StorageLive(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- StorageLive(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:45
- StorageLive(_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
-- _5 = const {alloc2: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
+- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43
+ _6 = const _; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
// mir::Constant
- // + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43
-- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
+- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
- _4 = &(*_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43
- _3 = [move _4]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46
- _2 = &_3; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55
@@ -50,5 +50,5 @@
}
}
-
-- alloc2 (extern static: X)
+- alloc3 (extern static: X)
diff --git a/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
new file mode 100644
index 000000000..d50b12044
--- /dev/null
+++ b/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff
@@ -0,0 +1,46 @@
+- // MIR for `fn0` before ConstProp
++ // MIR for `fn0` after ConstProp
+
+ fn fn0() -> bool {
+ let mut _0: bool; // return place in scope 0 at $DIR/address_of_pair.rs:+0:17: +0:21
+ let mut _1: !; // in scope 0 at $DIR/address_of_pair.rs:+0:22: +9:2
+ let mut _2: (i32, bool); // in scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17
+ let _4: (); // in scope 0 at $DIR/address_of_pair.rs:+4:5: +6:6
+ let mut _6: bool; // in scope 0 at $DIR/address_of_pair.rs:+7:16: +7:22
+ scope 1 {
+ debug pair => _2; // in scope 1 at $DIR/address_of_pair.rs:+1:9: +1:17
+ let _3: *mut bool; // in scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12
+ scope 2 {
+ debug ptr => _3; // in scope 2 at $DIR/address_of_pair.rs:+2:9: +2:12
+ let _5: bool; // in scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12
+ scope 3 {
+ }
+ scope 4 {
+ debug ret => _5; // in scope 4 at $DIR/address_of_pair.rs:+7:9: +7:12
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17
+ _2 = (const 1_i32, const false); // scope 0 at $DIR/address_of_pair.rs:+1:20: +1:30
+ StorageLive(_3); // scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12
+ _3 = &raw mut (_2.1: bool); // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ _2 = (const 1_i32, const false); // scope 2 at $DIR/address_of_pair.rs:+3:5: +3:22
+ StorageLive(_4); // scope 2 at $DIR/address_of_pair.rs:+4:5: +6:6
+ (*_3) = const true; // scope 3 at $DIR/address_of_pair.rs:+5:9: +5:20
+ _4 = const (); // scope 3 at $DIR/address_of_pair.rs:+4:5: +6:6
+ StorageDead(_4); // scope 2 at $DIR/address_of_pair.rs:+6:5: +6:6
+ StorageLive(_5); // scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12
+ StorageLive(_6); // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22
+ _6 = (_2.1: bool); // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22
+ _5 = Not(move _6); // scope 2 at $DIR/address_of_pair.rs:+7:15: +7:22
+ StorageDead(_6); // scope 2 at $DIR/address_of_pair.rs:+7:21: +7:22
+ _0 = _5; // scope 4 at $DIR/address_of_pair.rs:+8:12: +8:15
+ StorageDead(_5); // scope 2 at $DIR/address_of_pair.rs:+9:1: +9:2
+ StorageDead(_3); // scope 1 at $DIR/address_of_pair.rs:+9:1: +9:2
+ StorageDead(_2); // scope 0 at $DIR/address_of_pair.rs:+9:1: +9:2
+ return; // scope 0 at $DIR/address_of_pair.rs:+9:2: +9:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs
new file mode 100644
index 000000000..43dc9bae6
--- /dev/null
+++ b/tests/mir-opt/const_prop/address_of_pair.rs
@@ -0,0 +1,17 @@
+// unit-test: ConstProp
+
+// EMIT_MIR address_of_pair.fn0.ConstProp.diff
+pub fn fn0() -> bool {
+ let mut pair = (1, false);
+ let ptr = core::ptr::addr_of_mut!(pair.1);
+ pair = (1, false);
+ unsafe {
+ *ptr = true;
+ }
+ let ret = !pair.1;
+ return ret;
+}
+
+pub fn main() {
+ println!("{}", fn0());
+}
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff
index bedfa5992..85d6b5e3d 100644
--- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff
@@ -18,29 +18,35 @@
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10
_1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14
StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11
-- _4 = Eq(_1, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
+- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
+- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
++ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
}
bb1: {
-- _5 = Eq(_1, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _1) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
}
bb2: {
-- _2 = Rem(const 1_i32, _1); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
-+ _2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19
+ StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19
+ _0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2
StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
+ StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2
return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2
}
}
diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs
index a1078472c..93d558250 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 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
#[allow(unconditional_panic)]
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff
index e711babf0..d72675c2d 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff
@@ -6,16 +6,17 @@
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- let _5: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- let mut _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _7: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _8: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
+ let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
+ let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
scope 1 {
debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
scope 2 {
- let _4: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
+ let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
scope 3 {
- debug _b => _4; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
+ debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
}
}
}
@@ -23,27 +24,32 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _8 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
// mir::Constant
- // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35
+ // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
- _2 = &raw const (*_8); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
_1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
- StorageLive(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _5 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- _7 = Lt(_5, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ _7 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
+ StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
+ StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
+ _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
+ _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
++ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
}
bb1: {
- _4 = (*_1)[_5]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
- StorageDead(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
+- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
+ _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
+ StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
}
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff
index e711babf0..d72675c2d 100644
--- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff
@@ -6,16 +6,17 @@
let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- let _5: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- let mut _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _7: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- let mut _8: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35
+ let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
+ let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
scope 1 {
debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
scope 2 {
- let _4: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
+ let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
scope 3 {
- debug _b => _4; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
+ debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
}
}
}
@@ -23,27 +24,32 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10
StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
- _8 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
// mir::Constant
- // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35
+ // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35
// + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) }
- _2 = &raw const (*_8); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
+ _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
_1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35
StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35
- StorageLive(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
- StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _5 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
- _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- _7 = Lt(_5, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ _7 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
-+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36
+ StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15
+ StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
+ _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24
+ _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
++ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
}
bb1: {
- _4 = (*_1)[_5]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
- StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
- StorageDead(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
+- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25
+ StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26
+ _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6
+ StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6
StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2
return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2
}
diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs
index 3d252f2d2..ef148d16d 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,4 +1,7 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
+// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
+
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
#[allow(unconditional_panic)]
diff --git a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
index 85dedf68c..1752d222f 100644
--- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff
@@ -7,13 +7,17 @@
let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63
let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59
let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55
+ let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73
+ let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65
scope 1 {
debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22
let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21
scope 3 {
debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21
+ let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
scope 5 {
debug _enum_without_variants => const [ZeroSized: Empty]; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31
+ let _9: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
scope 7 {
debug _non_utf8_str => const Str::<"���">; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22
}
@@ -39,17 +43,25 @@
StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
_5 = InvalidTag { int: const 4_u32 }; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55
- _4 = (_5.1: E); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
-- _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
+ _4 = const Scalar(0x00000004): E; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
-+ _3 = [const Scalar(0x00000004): E]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
-+ // mir::Constant
-+ // + span: no-location
-+ // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) }
+ _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60
StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60
StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61
+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31
+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73
+ StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
+ _8 = NoVariants { int: const 0_u32 }; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65
+ nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71
+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74
+ nop; // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74
+ StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75
+ nop; // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22
+ nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2
+ nop; // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2
+ nop; // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2
StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+27:1: +27:2
StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+27:1: +27:2
return; // scope 0 at $DIR/invalid_constant.rs:+27:2: +27:2
diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs
index eb6172cdf..bdbc5a199 100644
--- a/tests/mir-opt/const_prop/invalid_constant.rs
+++ b/tests/mir-opt/const_prop/invalid_constant.rs
@@ -1,3 +1,5 @@
+// unit-test: ConstProp
+// compile-flags: -Zmir-enable-passes=+RemoveZsts
// Verify that we can pretty print invalid constants.
#![feature(adt_const_params)]
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff
index 5331e5b82..33bbad2f4 100644
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff
@@ -18,17 +18,20 @@
_2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
_3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
- _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
+- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
++ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
+ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
}
bb1: {
- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
+- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
+ _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
}
diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff
index 5331e5b82..33bbad2f4 100644
--- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff
@@ -18,17 +18,20 @@
_2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29
StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
_3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31
- _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
+- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
++ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
+ _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
}
bb1: {
- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
+- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32
StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33
+ _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2
StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2
return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2
}
diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs
index 073f98495..0876445bf 100644
--- a/tests/mir-opt/const_prop/large_array_index.rs
+++ b/tests/mir-opt/const_prop/large_array_index.rs
@@ -1,4 +1,6 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
+// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR large_array_index.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs
index c839f92f2..7bd30975a 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.rs
+++ b/tests/mir-opt/const_prop/mult_by_zero.rs
@@ -1,5 +1,4 @@
-// unit-test
-// compile-flags: -O -Zmir-opt-level=4
+// unit-test: ConstProp
// EMIT_MIR mult_by_zero.test.ConstProp.diff
fn test(x : i32) -> i32 {
diff --git a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
index 1cfe47d0a..629c8e601 100644
--- a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff
@@ -7,8 +7,11 @@
let mut _2: i32; // in scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
bb0: {
-- _0 = Mul(_1, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
+ StorageLive(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
+ _2 = _1; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4
+- _0 = Mul(move _2, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
+ _0 = const 0_i32; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8
+ StorageDead(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:7: +1:8
return; // scope 0 at $DIR/mult_by_zero.rs:+2:2: +2:2
}
}
diff --git a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
index a672c457a..bd010e7b1 100644
--- a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff
@@ -19,6 +19,7 @@
StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10
- _2 = _1; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14
+ _0 = const (); // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2
StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:+4:1: +4:2
StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:+4:1: +4:2
return; // scope 0 at $DIR/mutable_variable.rs:+4:2: +4:2
diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs
index cb01719dd..95987ef7f 100644
--- a/tests/mir-opt/const_prop/mutable_variable.rs
+++ b/tests/mir-opt/const_prop/mutable_variable.rs
@@ -1,5 +1,4 @@
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
// EMIT_MIR mutable_variable.main.ConstProp.diff
fn main() {
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 d088c4f66..539f6dd94 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
@@ -3,27 +3,26 @@
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +0:11
- let mut _3: i32; // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
- let mut _4: i32; // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
+ let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
scope 1 {
- debug x => (i32, i32){ .0 => _3, .1 => _4, }; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
- let _1: i32; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
- let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
+ debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
+ let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
scope 2 {
- debug y => (i32, i32){ .0 => _3, .1 => _2, }; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
+ debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
}
}
bb0: {
- StorageLive(_4); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
- _3 = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
- _4 = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
- _4 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13
+ StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14
+- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
++ _1 = const (42_i32, 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25
+ (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10
-- _2 = _4; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
-+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
+- _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
++ _2 = const (42_i32, 99_i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14
+ _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
- StorageDead(_4); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
+ StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2
return; // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:2: +4:2
}
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
index d4ff8d890..a145c0354 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs
@@ -1,5 +1,4 @@
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
fn main() {
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
index 134f0c080..bec641ecf 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff
@@ -9,10 +9,9 @@
let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
scope 2 {
debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10
- let _3: i32; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
- let _4: i32; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
+ let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
scope 3 {
- debug y => (i32, i32){ .0 => _3, .1 => _4, }; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
+ debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
}
}
}
@@ -24,11 +23,9 @@
_2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:13: +2:19
((*_2).1: i32) = const 99_i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+3:5: +3:13
StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
- StorageLive(_4); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10
- _3 = (_1.0: i32); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
- _4 = (_1.1: i32); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
+ _3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14
+ _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2
StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
- StorageDead(_4); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2
return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:2: +5:2
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 9060f7e9b..3099e659f 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,5 +1,4 @@
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
fn main() {
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff
index 75f6ebc58..374151057 100644
--- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff
@@ -16,7 +16,7 @@
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34
// mir::Constant
- // + span: $DIR/mutable_variable_aggregate_partial_read.rs:7:29: 7:32
+ // + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32
// + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(<ZST>) }
}
@@ -26,6 +26,7 @@
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10
- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16
+ _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2
return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2
diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs
index 70a287cf3..0e823e9dc 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,6 +1,5 @@
// ignore-wasm32 compiled with panic=abort by default
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
fn main() {
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 7fa29cccd..fab810630 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
@@ -4,34 +4,39 @@
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +0:11
let mut _1: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
- let mut _2: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- let mut _3: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ let _2: (); // in scope 0 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
+ let mut _3: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ let mut _4: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
scope 1 {
debug x => _1; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
- let _4: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
+ let _5: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
scope 2 {
}
scope 3 {
- debug y => _4; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
+ debug y => _5; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
}
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14
_1 = const 42_u32; // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:17: +1:19
- StorageLive(_2); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- _3 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ _4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
// mir::Constant
- // + span: $DIR/mutable_variable_no_prop.rs:10:13: 10:19
+ // + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19
// + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) }
- _2 = (*_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
- _1 = move _2; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19
- StorageDead(_2); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19
- StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20
- StorageLive(_4); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
- _4 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14
- StorageDead(_4); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
+ _3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19
+ _1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19
+ StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19
+ StorageDead(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20
+ _2 = const (); // scope 2 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6
+ StorageDead(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+4:5: +4:6
+ StorageLive(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10
+ _5 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14
+ _0 = const (); // scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +6:2
+ StorageDead(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
StorageDead(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2
return; // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:2: +6:2
}
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 b69ec931a..e51c62235 100644
--- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
@@ -1,5 +1,4 @@
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
static mut STATIC: u32 = 0x42424242;
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff
index 9582504b2..3048122d8 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff
@@ -4,17 +4,16 @@
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11
let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
- let mut _2: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
+ let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
scope 1 {
debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
- let mut _5: i32; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
- let mut _6: i32; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
+ let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
scope 2 {
- debug x => (i32, i32){ .0 => _5, .1 => _6, }; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
- let _3: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
+ debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
+ let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
scope 3 {
- debug y => _3; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
- let _4: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
+ debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
+ let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
scope 4 {
debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
}
@@ -26,22 +25,27 @@
StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10
_1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18
// mir::Constant
- // + span: $DIR/mutable_variable_unprop_assign.rs:7:13: 7:16
+ // + span: $DIR/mutable_variable_unprop_assign.rs:6:13: 6:16
// + literal: Const { ty: fn() -> i32 {foo}, val: Value(<ZST>) }
}
bb1: {
- StorageLive(_6); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
- _5 = const 1_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
- _6 = const 2_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
- StorageLive(_2); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- _2 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- _6 = move _2; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12
- StorageDead(_2); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
- StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
- _3 = _6; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16
- StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
- StorageDead(_6); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
+ StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14
+- _2 = (const 1_i32, const 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
++ _2 = const (1_i32, 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35
+ StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
+ _3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
+ (_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12
+ StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12
+ StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10
+ _4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16
+ StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10
+- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
++ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16
+ _0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2
+ StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
+ StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
+ StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2
return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2
}
diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
index fabd04e9b..5577f78a9 100644
--- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
+++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
@@ -1,6 +1,5 @@
// ignore-wasm32 compiled with panic=abort by default
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff
fn main() {
diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff
new file mode 100644
index 000000000..e3757941c
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff
@@ -0,0 +1,44 @@
+- // MIR for `concrete` before ConstProp
++ // MIR for `concrete` after ConstProp
+
+ fn concrete() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/offset_of.rs:+0:15: +0:15
+ let _1: usize; // in scope 0 at $DIR/offset_of.rs:+1:9: +1:10
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/offset_of.rs:+1:9: +1:10
+ let _2: usize; // in scope 1 at $DIR/offset_of.rs:+2:9: +2:10
+ scope 2 {
+ debug y => _2; // in scope 2 at $DIR/offset_of.rs:+2:9: +2:10
+ let _3: usize; // in scope 2 at $DIR/offset_of.rs:+3:9: +3:11
+ scope 3 {
+ debug z0 => _3; // in scope 3 at $DIR/offset_of.rs:+3:9: +3:11
+ let _4: usize; // in scope 3 at $DIR/offset_of.rs:+4:9: +4:11
+ scope 4 {
+ debug z1 => _4; // in scope 4 at $DIR/offset_of.rs:+4:9: +4:11
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:10
+- _1 = OffsetOf(Alpha, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
++ _1 = const 4_usize; // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:10
+- _2 = OffsetOf(Alpha, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
++ _2 = const 0_usize; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11
+- _3 = OffsetOf(Alpha, [2, 0]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
++ _3 = const 2_usize; // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11
+- _4 = OffsetOf(Alpha, [2, 1]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
++ _4 = const 3_usize; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:15: +5:2
+ StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2
+ StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2
+ StorageDead(_2); // scope 1 at $DIR/offset_of.rs:+5:1: +5:2
+ StorageDead(_1); // scope 0 at $DIR/offset_of.rs:+5:1: +5:2
+ return; // scope 0 at $DIR/offset_of.rs:+5:2: +5:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff
new file mode 100644
index 000000000..4a655604c
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff
@@ -0,0 +1,40 @@
+- // MIR for `generic` before ConstProp
++ // MIR for `generic` after ConstProp
+
+ fn generic() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/offset_of.rs:+0:17: +0:17
+ let _1: usize; // in scope 0 at $DIR/offset_of.rs:+1:9: +1:11
+ scope 1 {
+ debug gx => _1; // in scope 1 at $DIR/offset_of.rs:+1:9: +1:11
+ let _2: usize; // in scope 1 at $DIR/offset_of.rs:+2:9: +2:11
+ scope 2 {
+ debug gy => _2; // in scope 2 at $DIR/offset_of.rs:+2:9: +2:11
+ let _3: usize; // in scope 2 at $DIR/offset_of.rs:+3:9: +3:11
+ scope 3 {
+ debug dx => _3; // in scope 3 at $DIR/offset_of.rs:+3:9: +3:11
+ let _4: usize; // in scope 3 at $DIR/offset_of.rs:+4:9: +4:11
+ scope 4 {
+ debug dy => _4; // in scope 4 at $DIR/offset_of.rs:+4:9: +4:11
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:11
+ _1 = OffsetOf(Gamma<T>, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:11
+ _2 = OffsetOf(Gamma<T>, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11
+ _3 = OffsetOf(Delta<T>, [1]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11
+ _4 = OffsetOf(Delta<T>, [2]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:17: +5:2
+ StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2
+ StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2
+ StorageDead(_2); // scope 1 at $DIR/offset_of.rs:+5:1: +5:2
+ StorageDead(_1); // scope 0 at $DIR/offset_of.rs:+5:1: +5:2
+ return; // scope 0 at $DIR/offset_of.rs:+5:2: +5:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs
new file mode 100644
index 000000000..4cdcd28ee
--- /dev/null
+++ b/tests/mir-opt/const_prop/offset_of.rs
@@ -0,0 +1,48 @@
+// unit-test: ConstProp
+
+#![feature(offset_of)]
+
+use std::marker::PhantomData;
+use std::mem::offset_of;
+
+struct Alpha {
+ x: u8,
+ y: u16,
+ z: Beta,
+}
+
+struct Beta(u8, u8);
+
+struct Gamma<T> {
+ x: u8,
+ y: u16,
+ _t: T,
+}
+
+#[repr(C)]
+struct Delta<T> {
+ _phantom: PhantomData<T>,
+ x: u8,
+ y: u16,
+}
+
+// EMIT_MIR offset_of.concrete.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);
+}
+
+// EMIT_MIR offset_of.generic.ConstProp.diff
+fn generic<T>() {
+ let gx = offset_of!(Gamma<T>, x);
+ let gy = offset_of!(Gamma<T>, y);
+ let dx = offset_of!(Delta<T>, x);
+ let dy = offset_of!(Delta<T>, y);
+}
+
+fn main() {
+ concrete();
+ generic::<()>();
+}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir
deleted file mode 100644
index 81cfd22db..000000000
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir
+++ /dev/null
@@ -1,25 +0,0 @@
-// MIR for `main` after PreCodegen
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir
deleted file mode 100644
index 81cfd22db..000000000
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir
+++ /dev/null
@@ -1,25 +0,0 @@
-// MIR for `main` after PreCodegen
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir
deleted file mode 100644
index 002e914e8..000000000
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir
+++ /dev/null
@@ -1,25 +0,0 @@
-// MIR for `main` after SimplifyLocals-final
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir
deleted file mode 100644
index 002e914e8..000000000
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir
+++ /dev/null
@@ -1,25 +0,0 @@
-// MIR for `main` after SimplifyLocals-final
-
-fn main() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
- let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36
- scope 1 {
- debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 2 {
- debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- scope 3 {
- debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
- }
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
- StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
- StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2
- return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
- }
-}
diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff
index 388c6ca81..c290fba56 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
@@ -18,7 +18,7 @@
StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
_3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
// mir::Constant
- // + span: $DIR/read_immutable_static.rs:8:13: 8:16
+ // + span: $DIR/read_immutable_static.rs:7:13: 7:16
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
- _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
+ _2 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16
@@ -26,7 +26,7 @@
StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
_5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
// mir::Constant
- // + span: $DIR/read_immutable_static.rs:8:19: 8:22
+ // + span: $DIR/read_immutable_static.rs:7:19: 7:22
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
- _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22
- _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22
@@ -36,6 +36,7 @@
StorageDead(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22
StorageDead(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23
StorageDead(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23
+ _0 = const (); // scope 0 at $DIR/read_immutable_static.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/read_immutable_static.rs:+2:1: +2:2
return; // scope 0 at $DIR/read_immutable_static.rs:+2:2: +2:2
}
diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs
index 4f7afe6ca..fb8f9fe99 100644
--- a/tests/mir-opt/const_prop/read_immutable_static.rs
+++ b/tests/mir-opt/const_prop/read_immutable_static.rs
@@ -1,5 +1,4 @@
-// unit-test
-// compile-flags: -O
+// unit-test: ConstProp
static FOO: u8 = 2;
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
index 15c93f270..077b9bf83 100644
--- a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff
@@ -3,21 +3,26 @@
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +0:11
- let mut _1: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
- let mut _2: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
+ let mut _1: *const fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
+ let mut _2: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
+ let mut _3: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
scope 1 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
- StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
- _2 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
+ StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
+ StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
+ StorageLive(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
+ _3 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17
// mir::Constant
- // + span: $DIR/reify_fn_ptr.rs:4:13: 4:17
+ // + span: $DIR/reify_fn_ptr.rs:5:13: 5:17
// + literal: Const { ty: fn() {main}, val: Value(<ZST>) }
- _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
- StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26
- StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41
+ _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26
+ StorageDead(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26
+ _1 = move _2 as *const fn() (PointerFromExposedAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41
+ StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41
+ StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:41: +1:42
+ _0 = const (); // scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +2:2
return; // scope 0 at $DIR/reify_fn_ptr.rs:+2:2: +2:2
}
}
diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs
index bfe2563ad..5f6382066 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 @@
+// unit-test: ConstProp
// EMIT_MIR reify_fn_ptr.main.ConstProp.diff
fn main() {
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff
index 636032adb..6641220db 100644
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff
+++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff
@@ -20,11 +20,12 @@
_3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
_4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
- _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
+- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
++ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
+ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
}
bb1: {
@@ -35,6 +36,7 @@
StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
+ _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
}
diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff
index 636032adb..6641220db 100644
--- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff
+++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff
@@ -20,11 +20,12 @@
_3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25
StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27
_4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27
- _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
+- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
++ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
+ _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
-+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28
}
bb1: {
@@ -35,6 +36,7 @@
StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32
StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33
+ _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2
StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2
return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2
}
diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs
index 2f3b7d2c5..9c11dbc5b 100644
--- a/tests/mir-opt/const_prop/repeat.rs
+++ b/tests/mir-opt/const_prop/repeat.rs
@@ -1,7 +1,8 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
-// compile-flags: -O
-
+// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen
// EMIT_MIR_FOR_EACH_BIT_WIDTH
+
// EMIT_MIR repeat.main.ConstProp.diff
fn main() {
let x: u32 = [42; 8][2] + 0;
diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir
index ececd9942..b12d84fa4 100644
--- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir
+++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir
@@ -2,8 +2,14 @@
fn add() -> u32 {
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16
+ let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10
bb0: {
+ _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
+ }
+
+ bb1: {
_0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10
return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2
}
diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs
index ae119df85..0e68309f0 100644
--- a/tests/mir-opt/const_prop/return_place.rs
+++ b/tests/mir-opt/const_prop/return_place.rs
@@ -1,3 +1,4 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff
index a091b4ace..c2f97a0f6 100644
--- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff
@@ -11,15 +11,23 @@
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10
_1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14
-- _2 = consume(_1) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
-+ _2 = consume(const 1_u32) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
+ StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
+ StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
+- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
++ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14
+ _2 = consume(move _3) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15
// mir::Constant
- // + span: $DIR/scalar_literal_propagation.rs:5:5: 5:12
+ // + span: $DIR/scalar_literal_propagation.rs:6:5: 6:12
// + literal: Const { ty: fn(u32) {consume}, val: Value(<ZST>) }
}
bb1: {
+ StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15
+ StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16
+ _0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2
+ StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2
return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2
}
}
diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs
index e13e352f8..fc33cc2d0 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 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
// EMIT_MIR scalar_literal_propagation.main.ConstProp.diff
fn main() {
diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs
index 4499c54f2..9821d1b1e 100644
--- a/tests/mir-opt/const_prop/slice_len.rs
+++ b/tests/mir-opt/const_prop/slice_len.rs
@@ -1,6 +1,6 @@
// ignore-wasm32 compiled with panic=abort by default
// unit-test: ConstProp
-// compile-flags: -Zmir-enable-passes=+InstCombine
+// compile-flags: -Zmir-enable-passes=+InstSimplify
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR slice_len.main.ConstProp.diff
diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff
index 85704c48a..664b7839f 100644
--- a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff
@@ -15,14 +15,14 @@
bb1: {
_0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21
// mir::Constant
- // + span: $DIR/switch_int.rs:10:14: 10:17
+ // + span: $DIR/switch_int.rs:12:14: 12:17
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
}
bb2: {
_0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20
// mir::Constant
- // + span: $DIR/switch_int.rs:9:14: 9:17
+ // + span: $DIR/switch_int.rs:11:14: 11:17
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
}
diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff
index 0864db225..ef2c4d5fa 100644
--- a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff
+++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff
@@ -15,14 +15,14 @@
bb1: {
_0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21
// mir::Constant
- // + span: $DIR/switch_int.rs:10:14: 10:17
+ // + span: $DIR/switch_int.rs:12:14: 12:17
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
}
bb2: {
_0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20
// mir::Constant
- // + span: $DIR/switch_int.rs:9:14: 9:17
+ // + span: $DIR/switch_int.rs:11:14: 11:17
// + literal: Const { ty: fn(i32) {foo}, val: Value(<ZST>) }
}
diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs
index 2a2322e43..7158ea4d2 100644
--- a/tests/mir-opt/const_prop/switch_int.rs
+++ b/tests/mir-opt/const_prop/switch_int.rs
@@ -1,3 +1,5 @@
+// unit-test: ConstProp
+// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop
// ignore-wasm32 compiled with panic=abort by default
#[inline(never)]
fn foo(_: i32) { }
diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
index 933dfbb51..933dfbb51 100644
--- a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff
diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
new file mode 100644
index 000000000..933dfbb51
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `from_char` before ConstProp
++ // MIR for `from_char` after ConstProp
+
+ fn from_char() -> i32 {
+ let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28
++ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28
+ return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
index f3474855f..4a31194de 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff
@@ -7,7 +7,8 @@
}
bb0: {
- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30
+- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30
++ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30
return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
}
}
diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
new file mode 100644
index 000000000..4a31194de
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_bool` before ConstProp
++ // MIR for `invalid_bool` after ConstProp
+
+ fn invalid_bool() -> bool {
+ let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30
++ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30
+ return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
index ba087e226..2c541f2f6 100644
--- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff
@@ -7,7 +7,8 @@
}
bb0: {
- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
+- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
++ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
}
}
diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
new file mode 100644
index 000000000..2c541f2f6
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `invalid_char` before ConstProp
++ // MIR for `invalid_char` after ConstProp
+
+ fn invalid_char() -> char {
+ let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
++ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
+ return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
index 76d464789..76d464789 100644
--- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff
diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
new file mode 100644
index 000000000..76d464789
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff
@@ -0,0 +1,23 @@
+- // MIR for `less_as_i8` before ConstProp
++ // MIR for `less_as_i8` after ConstProp
+
+ fn less_as_i8() -> i8 {
+ let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26
+ let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48
+- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
+- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49
++ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) }
++ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49
+ StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49
+ return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs
index b753cdccd..762c42171 100644
--- a/tests/mir-opt/const_prop/transmute.rs
+++ b/tests/mir-opt/const_prop/transmute.rs
@@ -1,5 +1,7 @@
// unit-test: ConstProp
// compile-flags: -O --crate-type=lib
+// ignore-endian-big
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
use std::mem::transmute;
diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff
index 538b1f26e..538b1f26e 100644
--- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff
diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff
new file mode 100644
index 000000000..538b1f26e
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `undef_union_as_integer` before ConstProp
++ // MIR for `undef_union_as_integer` after ConstProp
+
+ fn undef_union_as_integer() -> u32 {
+ let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46
+ let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44
+ let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44
+ StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42
+ _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42
+ _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44
+ StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44
+ _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45
+ StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45
+ return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2
+ }
+ }
+
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
new file mode 100644
index 000000000..5258d75bd
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff
@@ -0,0 +1,23 @@
+- // MIR for `unreachable_box` before ConstProp
++ // MIR for `unreachable_box` after ConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
+ let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: Box<Never>, val: Value(Scalar(0x00000001)) }
+ unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ }
+ }
+
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
new file mode 100644
index 000000000..7e57e06a5
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff
@@ -0,0 +1,23 @@
+- // MIR for `unreachable_box` before ConstProp
++ // MIR for `unreachable_box` after ConstProp
+
+ fn unreachable_box() -> ! {
+ let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
+ let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+- _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: Box<Never>, val: Value(Scalar(0x0000000000000001)) }
+ unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff
deleted file mode 100644
index 8bf97996a..000000000
--- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-- // MIR for `unreachable_box` before ConstProp
-+ // MIR for `unreachable_box` after ConstProp
-
- fn unreachable_box() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2
- let _2: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16
- scope 1 {
- debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
- }
- scope 2 {
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2
- StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- _2 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
- StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16
- unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
- }
- }
-
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
new file mode 100644
index 000000000..032681f23
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_direct` before ConstProp
++ // MIR for `unreachable_direct` after ConstProp
+
+ fn unreachable_direct() -> ! {
+ let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
+ let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
+ _2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
+ _1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
+ unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
new file mode 100644
index 000000000..032681f23
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff
@@ -0,0 +1,22 @@
+- // MIR for `unreachable_direct` before ConstProp
++ // MIR for `unreachable_direct` after ConstProp
+
+ fn unreachable_direct() -> ! {
+ let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
+ let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
+ _2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
+ _1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
+ unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff
deleted file mode 100644
index 81b7b3689..000000000
--- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-- // MIR for `unreachable_direct` before ConstProp
-+ // MIR for `unreachable_direct` after ConstProp
-
- fn unreachable_direct() -> ! {
- let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
- let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:41: +3:2
- let _2: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _3: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
- let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:15
- scope 1 {
- debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
- }
- scope 2 {
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:41: +3:2
- StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- StorageLive(_3); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
- _3 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
- _2 = move _3 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
- unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
- }
- }
-
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
index 34f7aea8e..ec8a62bd6 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff
@@ -3,24 +3,24 @@
fn unreachable_mut() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2
- let _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _3: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
- let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16
+ let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
scope 1 {
- debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2
- StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- StorageLive(_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
- _3 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
- _2 = &mut (*_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
- StorageDead(_3); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
- StorageLive(_4); // scope 1 at $DIR/transmute.rs:+2:5: +2:16
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
+- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x00000001)) }
+ _1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
+ StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
new file mode 100644
index 000000000..288da6e56
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff
@@ -0,0 +1,27 @@
+- // MIR for `unreachable_mut` before ConstProp
++ // MIR for `unreachable_mut` after ConstProp
+
+ fn unreachable_mut() -> ! {
+ let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
+ let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
+- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x0000000000000001)) }
+ _1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
+ StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
+ unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
index ff95f2a0b..dcca0fca6 100644
--- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff
@@ -3,20 +3,20 @@
fn unreachable_ref() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
- let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2
- let _2: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
- let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16
+ let _1: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
scope 1 {
- debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2
- StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- _2 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48
- StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+- _1 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48
++ _1 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: &Never, val: Value(Scalar(0x00000001)) }
unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
}
}
diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
new file mode 100644
index 000000000..3a0b967e6
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff
@@ -0,0 +1,23 @@
+- // MIR for `unreachable_ref` before ConstProp
++ // MIR for `unreachable_ref` after ConstProp
+
+ fn unreachable_ref() -> ! {
+ let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
+ let _1: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
+ }
+ scope 2 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
+- _1 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48
++ _1 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48
++ // mir::Constant
++ // + span: no-location
++ // + literal: Const { ty: &Never, val: Value(Scalar(0x0000000000000001)) }
+ unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
index eac33b730..eac33b730 100644
--- a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff
+++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff
diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
new file mode 100644
index 000000000..eac33b730
--- /dev/null
+++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff
@@ -0,0 +1,15 @@
+- // MIR for `valid_char` before ConstProp
++ // MIR for `valid_char` after ConstProp
+
+ fn valid_char() -> char {
+ let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28
+ scope 1 {
+ }
+
+ bb0: {
+- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
++ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
+ return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff
index 12313b6c5..e4a7c0d1e 100644
--- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff
+++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff
@@ -11,15 +11,24 @@
}
bb0: {
+ StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10
- _1 = (const 1_u32, const 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
+ _1 = const (1_u32, 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19
- _2 = consume(_1) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
+ StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
+ StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
+- _3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
++ _3 = const (1_u32, 2_u32); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14
+ _2 = consume(move _3) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15
// mir::Constant
- // + span: $DIR/tuple_literal_propagation.rs:6:5: 6:12
+ // + span: $DIR/tuple_literal_propagation.rs:7:5: 7:12
// + literal: Const { ty: fn((u32, u32)) {consume}, val: Value(<ZST>) }
}
bb1: {
+ StorageDead(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:14: +3:15
+ StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16
+ _0 = const (); // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2
+ StorageDead(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+4:1: +4:2
return; // scope 0 at $DIR/tuple_literal_propagation.rs:+4:2: +4:2
}
}
diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs
index edd748d00..f342ae270 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 @@
+// unit-test: ConstProp
// ignore-wasm32 compiled with panic=abort by default
// EMIT_MIR tuple_literal_propagation.main.ConstProp.diff
fn main() {
diff --git a/tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
index a4f2d8c84..377324218 100644
--- a/tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff
+++ b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff
@@ -4,8 +4,13 @@
fn change_loop_body() -> () {
let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27
let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15
- let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/while_let_loops.rs:+2:28: +2:32
- let mut _3: isize; // in scope 0 at $DIR/while_let_loops.rs:+2:15: +2:25
+ let mut _2: (); // in scope 0 at $DIR/while_let_loops.rs:+0:1: +6:2
+ let mut _3: std::option::Option<u32>; // in scope 0 at $DIR/while_let_loops.rs:+2:28: +2:32
+ let mut _4: isize; // in scope 0 at $DIR/while_let_loops.rs:+2:15: +2:25
+ let mut _5: !; // in scope 0 at $DIR/while_let_loops.rs:+2:33: +5:6
+ let mut _6: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6
+ let _7: (); // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6
+ let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6
scope 1 {
debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15
scope 2 {
@@ -15,29 +20,33 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15
_1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:+1:18: +1:19
- StorageLive(_2); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32
- _2 = Option::<u32>::None; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32
-- _3 = discriminant(_2); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
-- switchInt(move _3) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
-+ _3 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
+ StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32
+ _3 = Option::<u32>::None; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32
+- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
+- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
+ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
}
bb1: {
- switchInt(((_2 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
+ switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25
}
bb2: {
_1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:+3:9: +3:15
+ _0 = const (); // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14
goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14
}
bb3: {
+ StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6
+ _0 = const (); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6
+ StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6
goto -> bb4; // scope 1 at no-location
}
bb4: {
- StorageDead(_2); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6
+ StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6
StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2
return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2
}
diff --git a/tests/mir-opt/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs
index fc56cd698..595a94b88 100644
--- a/tests/mir-opt/while_let_loops.rs
+++ b/tests/mir-opt/const_prop/while_let_loops.rs
@@ -1,5 +1,5 @@
+// unit-test: ConstProp
// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff
-// EMIT_MIR while_let_loops.change_loop_body.PreCodegen.after.mir
pub fn change_loop_body() {
let mut _x = 0;
diff --git a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
index def9fc642..a5f52d089 100644
--- a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
+++ b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff
@@ -19,8 +19,7 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
-- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
-+ _1 = const (1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
+ _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +4:6
StorageLive(_3); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
_3 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22
diff --git a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
index b54c10a14..42ddc2a56 100644
--- a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
+++ b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff
@@ -16,8 +16,7 @@
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14
-- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
-+ _1 = const (1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
+ _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21
StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14
_2 = &mut (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14
(*_2) = const 5_i32; // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +2:18
diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff
index 2a0bff57d..51707e716 100644
--- a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff
+++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff
@@ -20,8 +20,7 @@
}
bb1: {
-- _0 = opaque::<u8>(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38
-+ _0 = opaque::<u8>(_1) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38
+ _0 = opaque::<u8>(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38
// mir::Constant
// + span: $DIR/borrowed_local.rs:28:28: 28:34
// + literal: Const { ty: fn(u8) -> bool {opaque::<u8>}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff
index 69acebf76..1c7b6494d 100644
--- a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff
+++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff
@@ -6,15 +6,17 @@
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
scope 1 {
- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
+- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
++ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
+- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10
+- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
++ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14
_1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12
- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2
+- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6
+- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2
return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2
}
}
diff --git a/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff b/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff
new file mode 100644
index 000000000..586643905
--- /dev/null
+++ b/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff
@@ -0,0 +1,13 @@
+- // MIR for `main` before CopyProp
++ // MIR for `main` after CopyProp
+
+ fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/partial_init.rs:+0:15: +0:15
+ let mut _1: (isize,); // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ (_1.0: isize) = const 1_isize; // scope 0 at $DIR/partial_init.rs:+4:13: +4:20
+ return; // scope 0 at $DIR/partial_init.rs:+5:13: +5:21
+ }
+ }
+
diff --git a/tests/mir-opt/copy-prop/partial_init.rs b/tests/mir-opt/copy-prop/partial_init.rs
new file mode 100644
index 000000000..f5ab9974f
--- /dev/null
+++ b/tests/mir-opt/copy-prop/partial_init.rs
@@ -0,0 +1,18 @@
+// unit-test: CopyProp
+// Verify that we do not ICE on partial initializations.
+
+#![feature(custom_mir, core_intrinsics)]
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR partial_init.main.CopyProp.diff
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+pub fn main() {
+ mir! (
+ let x: (isize, );
+ {
+ x.0 = 1;
+ Return()
+ }
+ )
+}
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
new file mode 100644
index 000000000..761c074ed
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff
@@ -0,0 +1,25 @@
+- // MIR for `main` before DeadStoreElimination
++ // MIR for `main` after DeadStoreElimination
+
+ fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/place_mention.rs:+0:11: +0:11
+ let mut _1: (&str, &str); // in scope 0 at $DIR/place_mention.rs:+3:18: +3:36
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
+ _1 = (const "Hello", const "World"); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
+ // mir::Constant
+ // + span: $DIR/place_mention.rs:8:19: 8:26
+ // + literal: Const { ty: &str, val: Value(Slice(..)) }
+ // mir::Constant
+ // + span: $DIR/place_mention.rs:8:28: 8:35
+ // + literal: Const { ty: &str, val: Value(Slice(..)) }
+ PlaceMention(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36
+ StorageDead(_1); // scope 0 at $DIR/place_mention.rs:+3:36: +3:37
+ _0 = const (); // scope 0 at $DIR/place_mention.rs:+0:11: +4:2
+ return; // scope 0 at $DIR/place_mention.rs:+4:2: +4:2
+ }
+ }
+
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs
new file mode 100644
index 000000000..59dc74454
--- /dev/null
+++ b/tests/mir-opt/dead-store-elimination/place_mention.rs
@@ -0,0 +1,9 @@
+// unit-test: DeadStoreElimination
+// compile-flags: -Zmir-keep-place-mention
+
+// EMIT_MIR place_mention.main.DeadStoreElimination.diff
+fn main() {
+ // Verify that we account for the `PlaceMention` statement as a use of the tuple,
+ // and don't remove it as a dead store.
+ let (_, _) = ("Hello", "World");
+}
diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff
index c0fc1fb1d..cadf05152 100644
--- a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff
+++ b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `generic` before InstCombine
-+ // MIR for `generic` after InstCombine
+- // MIR for `generic` before InstSimplify
++ // MIR for `generic` after InstSimplify
fn generic() -> () {
let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21
diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs
index 7cec761ea..38cc5a293 100644
--- a/tests/mir-opt/dont_yeet_assert.rs
+++ b/tests/mir-opt/dont_yeet_assert.rs
@@ -1,11 +1,11 @@
// compile-flags: --crate-type=lib
-// unit-test: InstCombine
+// 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.InstCombine.diff
+// 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/equal_true.opt.InstCombine.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff
index 8b542a7c1..4ef413200 100644
--- a/tests/mir-opt/equal_true.opt.InstCombine.diff
+++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `opt` before InstCombine
-+ // MIR for `opt` after InstCombine
+- // MIR for `opt` before InstSimplify
++ // MIR for `opt` after InstSimplify
fn opt(_1: bool) -> i32 {
debug x => _1; // in scope 0 at $DIR/equal_true.rs:+0:8: +0:9
diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs
index 717d10c6d..fbb5d8d37 100644
--- a/tests/mir-opt/equal_true.rs
+++ b/tests/mir-opt/equal_true.rs
@@ -1,6 +1,6 @@
-// unit-test InstCombine
+// unit-test InstSimplify
-// EMIT_MIR equal_true.opt.InstCombine.diff
+// EMIT_MIR equal_true.opt.InstSimplify.diff
fn opt(x: bool) -> i32 {
if x == true { 0 } else { 1 }
diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.diff
index 18df6f9af..3aebfb69e 100644
--- a/tests/mir-opt/inline/issue_106141.outer.Inline.diff
+++ b/tests/mir-opt/inline/issue_106141.outer.Inline.diff
@@ -8,7 +8,7 @@
+ let mut _2: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21
+ let mut _3: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:12:18: 12:25
+ scope 2 {
-+ debug buffer => _3; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15
++ debug buffer => const _; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15
+ scope 3 {
+ debug index => _0; // in scope 3 at $DIR/issue_106141.rs:13:9: 13:14
+ }
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
index 6184a0acd..d76cd0e2b 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff
@@ -10,50 +10,52 @@
+ scope 1 (inlined core::num::<impl u16>::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23
+ debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+ debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ let mut _6: std::option::Option<u16>; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ let mut _7: std::result::Result<u16, std::num::TryFromIntError>; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
++ let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ scope 2 {
-+ scope 3 (inlined <u32 as TryInto<u16>>::try_into) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ debug self => _4; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ scope 4 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ debug u => _4; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _8: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _9: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _10: u16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+ }
-+ scope 5 (inlined Result::<u16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let mut _11: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let _12: u16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ scope 6 {
-+ debug x => _12; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+ scope 7 {
-+ scope 8 {
-+ debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
++ scope 3 (inlined core::num::<impl u16>::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _8: std::option::Option<u16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _9: std::result::Result<u16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ scope 4 {
++ scope 5 (inlined <u32 as TryInto<u16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
++ scope 6 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
++ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ let mut _12: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ }
+ }
-+ }
-+ }
-+ scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _13: &std::option::Option<u16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 10 {
-+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ scope 11 {
-+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 14 {
-+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
++ scope 7 (inlined Result::<u16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ let _14: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ scope 8 {
++ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
++ }
++ }
++ scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ let mut _15: &std::option::Option<u16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ scope 10 {
++ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
++ }
++ scope 11 {
++ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
++ scope 14 {
++ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
++ }
++ }
+ }
+ }
++ scope 12 (inlined Option::<u16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
++ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
++ }
+ }
+ }
-+ scope 12 (inlined Option::<u16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
+ }
+ }
+ }
@@ -67,75 +69,81 @@
- // mir::Constant
- // + span: $DIR/unchecked_shifts.rs:11:7: 11:20
- // + literal: Const { ty: unsafe fn(u16, u32) -> u16 {core::num::<impl u16>::unchecked_shl}, val: Value(<ZST>) }
-+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _9 = const 65535_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _8 = Gt(_4, move _9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ switchInt(move _8) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _11 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
}
bb1: {
-+ StorageDead(_12); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ StorageLive(_13); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ switchInt(move _14) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+
-+ bb2: {
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
+ }
+
-+ bb3: {
-+ _7 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ bb2: {
++ _9 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
-+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ }
++
++ bb3: {
++ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _12 = _7 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _9 = Result::<u16, TryFromIntError>::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ }
+
+ bb4: {
-+ StorageLive(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _10 = _4 as u16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _7 = Result::<u16, TryFromIntError>::Ok(move _10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb5: {
-+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_12); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ _11 = discriminant(_7); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ switchInt(move _11) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
++ _8 = Option::<u16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb6: {
-+ _6 = Option::<u16>::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb7: {
-+ unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
++ _14 = move ((_9 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ _8 = Option::<u16>::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb8: {
-+ _12 = move ((_7 as Ok).0: u16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ _6 = Option::<u16>::Some(move _12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
++ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ }
+
+ bb9: {
-+ _5 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ StorageDead(_13); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
-+ _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
++ _5 = move ((_8 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::<u16>}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
index 726b6bbf9..3c175ed15 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir
@@ -7,122 +7,130 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
scope 1 (inlined core::num::<impl u16>::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23
debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- let mut _4: std::option::Option<u16>; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- let mut _5: std::result::Result<u16, std::num::TryFromIntError>; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+ let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
scope 2 {
- scope 3 (inlined <u32 as TryInto<u16>>::try_into) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- debug self => _2; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- scope 4 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- debug u => _2; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _6: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _7: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _8: u16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
- }
- scope 5 (inlined Result::<u16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- debug self => _5; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _9: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let _10: u16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- scope 6 {
- debug x => _10; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
- }
- scope 7 {
- scope 8 {
- debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ scope 3 (inlined core::num::<impl u16>::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _6: std::option::Option<u16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _7: std::result::Result<u16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ scope 4 {
+ scope 5 (inlined <u32 as TryInto<u16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ scope 6 (inlined convert::num::<impl TryFrom<u32> for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ let mut _10: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ }
}
- }
- }
- scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- debug self => _4; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _11: &std::option::Option<u16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _12: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- scope 10 {
- debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- scope 11 {
- scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
- scope 14 {
- scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 7 (inlined Result::<u16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ let _12: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ scope 8 {
+ debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+ }
+ scope 9 (inlined #[track_caller] Option::<u16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _13: &std::option::Option<u16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ scope 10 {
+ debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
+ }
+ scope 11 {
+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
+ scope 14 {
+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ }
+ }
}
}
+ scope 12 (inlined Option::<u16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
+ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
+ }
}
}
- scope 12 (inlined Option::<u16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
- debug self => _11; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
- }
}
}
}
bb0: {
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageLive(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _7 = const 65535_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _6 = Gt(_2, move _7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _9 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
}
bb1: {
- StorageDead(_10); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageLive(_11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- _12 = discriminant(_4); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _12) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb2: {
StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
}
- bb3: {
- _5 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ bb2: {
+ _7 = Result::<u16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
// mir::Constant
// + span: no-location
// + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
- goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ }
+
+ bb3: {
+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _10 = _5 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _7 = Result::<u16, TryFromIntError>::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
}
bb4: {
- StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _8 = _2 as u16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _5 = Result::<u16, TryFromIntError>::Ok(move _8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb5: {
- StorageDead(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_10); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- _9 = discriminant(_5); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- switchInt(move _9) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ _6 = Option::<u16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb6: {
- _4 = Option::<u16>::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb7: {
- unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ _12 = move ((_7 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ _6 = Option::<u16>::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb8: {
- _10 = move ((_5 as Ok).0: u16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- _4 = Option::<u16>::Some(move _10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
}
bb9: {
- _3 = move ((_4 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
- _0 = unchecked_shl::<u16>(_1, move _3) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
+ _3 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _0 = unchecked_shl::<u16>(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::<u16>}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
index 35d5b6e72..f3d3e6090 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff
@@ -10,50 +10,52 @@
+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23
+ debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
+ debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ let mut _6: std::option::Option<i16>; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ let mut _7: std::result::Result<i16, std::num::TryFromIntError>; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
++ let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ scope 2 {
-+ scope 3 (inlined <u32 as TryInto<i16>>::try_into) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ debug self => _4; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ scope 4 (inlined convert::num::<impl TryFrom<u32> for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
-+ debug u => _4; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _8: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _9: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ let mut _10: i16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ }
-+ }
-+ scope 5 (inlined Result::<i16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let mut _11: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ let _12: i16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ scope 6 {
-+ debug x => _12; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
-+ }
-+ scope 7 {
-+ scope 8 {
-+ debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
++ scope 3 (inlined core::num::<impl i16>::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _8: std::option::Option<i16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ let mut _9: std::result::Result<i16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ scope 4 {
++ scope 5 (inlined <u32 as TryInto<i16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
++ scope 6 (inlined convert::num::<impl TryFrom<u32> for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
++ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ let mut _12: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ }
+ }
-+ }
-+ }
-+ scope 9 (inlined #[track_caller] Option::<i16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _13: &std::option::Option<i16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 10 {
-+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+ scope 11 {
-+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ scope 14 {
-+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
++ scope 7 (inlined Result::<i16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ let _14: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ scope 8 {
++ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
++ }
++ }
++ scope 9 (inlined #[track_caller] Option::<i16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ let mut _15: &std::option::Option<i16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ scope 10 {
++ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
++ }
++ scope 11 {
++ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
++ scope 14 {
++ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
++ }
++ }
+ }
+ }
++ scope 12 (inlined Option::<i16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
++ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
++ }
+ }
+ }
-+ scope 12 (inlined Option::<i16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
-+ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
+ }
+ }
+ }
@@ -67,75 +69,81 @@
- // mir::Constant
- // + span: $DIR/unchecked_shifts.rs:17:7: 17:20
- // + literal: Const { ty: unsafe fn(i16, u32) -> i16 {core::num::<impl i16>::unchecked_shr}, val: Value(<ZST>) }
-+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _9 = const 32767_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _8 = Gt(_4, move _9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ switchInt(move _8) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _11 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
}
bb1: {
-+ StorageDead(_12); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ StorageLive(_13); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ switchInt(move _14) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ }
-+
-+ bb2: {
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23
return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
+ }
+
-+ bb3: {
-+ _7 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ bb2: {
++ _9 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
-+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ }
++
++ bb3: {
++ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _12 = _7 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ _9 = Result::<i16, TryFromIntError>::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ }
+
+ bb4: {
-+ StorageLive(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _10 = _4 as i16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ _7 = Result::<i16, TryFromIntError>::Ok(move _10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageDead(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
++ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb5: {
-+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
-+ StorageLive(_12); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ _11 = discriminant(_7); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ switchInt(move _11) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
++ _8 = Option::<i16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb6: {
-+ _6 = Option::<i16>::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb7: {
-+ unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
++ _14 = move ((_9 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
++ _8 = Option::<i16>::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+
+ bb8: {
-+ _12 = move ((_7 as Ok).0: i16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
-+ _6 = Option::<i16>::Some(move _12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
-+ goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
++ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ }
+
+ bb9: {
-+ _5 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
-+ StorageDead(_13); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
-+ _0 = unchecked_shr::<i16>(_3, move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
++ _5 = move ((_8 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
++ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
++ _0 = unchecked_shr::<i16>(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL
+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::<i16>}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
index b006085b5..724b3c567 100644
--- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
+++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir
@@ -7,122 +7,130 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 {
scope 1 (inlined core::num::<impl i16>::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23
debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- let mut _4: std::option::Option<i16>; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- let mut _5: std::result::Result<i16, std::num::TryFromIntError>; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
+ let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL
scope 2 {
- scope 3 (inlined <u32 as TryInto<i16>>::try_into) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- debug self => _2; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- scope 4 (inlined convert::num::<impl TryFrom<u32> for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
- debug u => _2; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _6: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _7: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- let mut _8: i16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- }
- }
- scope 5 (inlined Result::<i16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- debug self => _5; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let mut _9: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- let _10: i16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- scope 6 {
- debug x => _10; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
- }
- scope 7 {
- scope 8 {
- debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ scope 3 (inlined core::num::<impl i16>::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _6: std::option::Option<i16>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ let mut _7: std::result::Result<i16, std::num::TryFromIntError>; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ scope 4 {
+ scope 5 (inlined <u32 as TryInto<i16>>::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ scope 6 (inlined convert::num::<impl TryFrom<u32> for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL
+ debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ let mut _10: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ }
}
- }
- }
- scope 9 (inlined #[track_caller] Option::<i16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- debug self => _4; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _11: &std::option::Option<i16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _12: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- scope 10 {
- debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
- }
- scope 11 {
- scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
- scope 14 {
- scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 7 (inlined Result::<i16, TryFromIntError>::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ let _12: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ scope 8 {
+ debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ }
+ }
+ scope 9 (inlined #[track_caller] Option::<i16>::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _13: &std::option::Option<i16>; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ scope 10 {
+ debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL
+ }
+ scope 11 {
+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL
+ scope 14 {
+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ }
+ }
}
}
+ scope 12 (inlined Option::<i16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
+ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
+ }
}
}
- scope 12 (inlined Option::<i16>::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL
- debug self => _11; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL
- }
}
}
}
bb0: {
- StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageLive(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _7 = const 32767_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _6 = Gt(_2, move _7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _9 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
}
bb1: {
- StorageDead(_10); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageLive(_11); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- _12 = discriminant(_4); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _12) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- }
-
- bb2: {
StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2
}
- bb3: {
- _5 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ bb2: {
+ _7 = Result::<i16, TryFromIntError>::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
// mir::Constant
// + span: no-location
// + literal: Const { ty: TryFromIntError, val: Value(<ZST>) }
- goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ }
+
+ bb3: {
+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _10 = _5 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ _7 = Result::<i16, TryFromIntError>::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
}
bb4: {
- StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _8 = _2 as i16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- _5 = Result::<i16, TryFromIntError>::Ok(move _8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL
+ StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb5: {
- StorageDead(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL
- StorageLive(_10); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- _9 = discriminant(_5); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- switchInt(move _9) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ _6 = Option::<i16>::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb6: {
- _4 = Option::<i16>::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb7: {
- unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ _12 = move ((_7 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
+ _6 = Option::<i16>::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb8: {
- _10 = move ((_5 as Ok).0: i16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- _4 = Option::<i16>::Some(move _10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
}
bb9: {
- _3 = move ((_4 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
- StorageDead(_11); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
- _0 = unchecked_shr::<i16>(_1, move _3) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
+ _3 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL
+ StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL
+ _0 = unchecked_shr::<i16>(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::<i16>}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
new file mode 100644
index 000000000..745f2bb19
--- /dev/null
+++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff
@@ -0,0 +1,50 @@
+- // MIR for `caller` before Inline
++ // MIR for `caller` after Inline
+
+ fn caller(_1: Box<[i32]>) -> () {
+ debug x => _1; // in scope 0 at $DIR/unsized_argument.rs:+0:11: +0:12
+ let mut _0: (); // return place in scope 0 at $DIR/unsized_argument.rs:+0:26: +0:26
+ let _2: (); // in scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
+ let mut _3: std::boxed::Box<[i32]>; // in scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
+ let mut _4: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
+ let mut _5: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
+ let mut _6: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
+ let mut _7: *const [i32]; // in scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
+ StorageLive(_3); // scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
+ _3 = move _1; // scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14
+ _7 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]); // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
+ _2 = callee(move (*_7)) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15
+ // mir::Constant
+ // + span: $DIR/unsized_argument.rs:9:5: 9:11
+ // + literal: Const { ty: fn([i32]) {callee}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_3); // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
+ StorageDead(_2); // scope 0 at $DIR/unsized_argument.rs:+1:15: +1:16
+ _0 = const (); // scope 0 at $DIR/unsized_argument.rs:+0:26: +2:2
+ return; // scope 0 at $DIR/unsized_argument.rs:+2:2: +2:2
+ }
+
+ bb2 (cleanup): {
+ resume; // scope 0 at $DIR/unsized_argument.rs:+0:1: +2:2
+ }
+
+ bb3: {
+ _4 = alloc::alloc::box_free::<[i32], std::alloc::Global>(move (_3.0: std::ptr::Unique<[i32]>), move (_3.1: std::alloc::Global)) -> bb1; // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
+ // mir::Constant
+ // + span: $DIR/unsized_argument.rs:9:14: 9:15
+ // + literal: Const { ty: unsafe fn(Unique<[i32]>, std::alloc::Global) {alloc::alloc::box_free::<[i32], std::alloc::Global>}, val: Value(<ZST>) }
+ }
+
+ bb4 (cleanup): {
+ _6 = alloc::alloc::box_free::<[i32], std::alloc::Global>(move (_3.0: std::ptr::Unique<[i32]>), move (_3.1: std::alloc::Global)) -> [return: bb2, unwind terminate]; // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15
+ // mir::Constant
+ // + span: $DIR/unsized_argument.rs:9:14: 9:15
+ // + literal: Const { ty: unsafe fn(Unique<[i32]>, std::alloc::Global) {alloc::alloc::box_free::<[i32], std::alloc::Global>}, val: Value(<ZST>) }
+ }
+ }
+
diff --git a/tests/mir-opt/inline/unsized_argument.rs b/tests/mir-opt/inline/unsized_argument.rs
new file mode 100644
index 000000000..b2c51407f
--- /dev/null
+++ b/tests/mir-opt/inline/unsized_argument.rs
@@ -0,0 +1,15 @@
+// needs-unwind
+#![feature(unsized_fn_params)]
+
+#[inline(always)]
+fn callee(y: [i32]) {}
+
+// EMIT_MIR unsized_argument.caller.Inline.diff
+fn caller(x: Box<[i32]>) {
+ callee(*x);
+}
+
+fn main() {
+ let b = Box::new([1]);
+ caller(b);
+}
diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff
index 543ddcfc4..8a8cd896e 100644
--- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff
+++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff
@@ -34,7 +34,7 @@
- // + literal: Const { ty: unsafe fn(Option<T>) -> T {Option::<T>::unwrap_unchecked}, val: Value(<ZST>) }
+ StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27
+ _4 = discriminant(_2); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
-+ switchInt(move _4) -> [0: bb1, 1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
++ switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL
}
bb1: {
diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
index e04079453..04ba8dd8e 100644
--- a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff
+++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff
@@ -1,21 +1,21 @@
-- // MIR for `assert_zero` before InstCombine
-+ // MIR for `assert_zero` after InstCombine
+- // MIR for `assert_zero` before InstSimplify
++ // MIR for `assert_zero` after InstSimplify
fn assert_zero(_1: u8) -> u8 {
- let mut _0: u8; // return place in scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+0:37: +0:39
+ let mut _0: u8; // return place in scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+0:37: +0:39
bb0: {
-- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14
-+ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14
+- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14
++ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14
}
bb1: {
- unreachable; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+10:13: +10:26
+ unreachable; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+10:13: +10:26
}
bb2: {
- _0 = _1; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+13:13: +13:20
- return; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+14:13: +14:21
+ _0 = _1; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+13:13: +13:20
+ return; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+14:13: +14:21
}
}
diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs
index ef3b487af..3e280a40f 100644
--- a/tests/mir-opt/instcombine_duplicate_switch_targets.rs
+++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs
@@ -3,9 +3,9 @@
use std::intrinsics::mir::*;
-// unit-test: InstCombine
+// unit-test: InstSimplify
-// EMIT_MIR instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff
+// 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!(
diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff
index 09fc145e7..a59f4a43a 100644
--- a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff
+++ b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `generic` before InstCombine
-+ // MIR for `generic` after InstCombine
+- // MIR for `generic` before InstSimplify
++ // MIR for `generic` after InstSimplify
fn generic() -> () {
let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +0:21
diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff
index c52174ef5..195e8bd4e 100644
--- a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff
+++ b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `panics` before InstCombine
-+ // MIR for `panics` after InstCombine
+- // MIR for `panics` before InstSimplify
++ // MIR for `panics` after InstSimplify
fn panics() -> () {
let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +0:17
diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff
index d059d47ee..a4a65074c 100644
--- a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff
+++ b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `removable` before InstCombine
-+ // MIR for `removable` after InstCombine
+- // MIR for `removable` before InstSimplify
++ // MIR for `removable` after InstSimplify
fn removable() -> () {
let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +0:20
diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/intrinsic_asserts.rs
index 8fb99cdf6..302d4bda1 100644
--- a/tests/mir-opt/intrinsic_asserts.rs
+++ b/tests/mir-opt/intrinsic_asserts.rs
@@ -2,7 +2,7 @@
#![feature(core_intrinsics)]
// All these assertions pass, so all the intrinsic calls should be deleted.
-// EMIT_MIR intrinsic_asserts.removable.InstCombine.diff
+// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff
pub fn removable() {
core::intrinsics::assert_inhabited::<()>();
core::intrinsics::assert_zero_valid::<u8>();
@@ -12,7 +12,7 @@ pub fn removable() {
enum Never {}
// These assertions all diverge, so their target blocks should become None.
-// EMIT_MIR intrinsic_asserts.panics.InstCombine.diff
+// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff
pub fn panics() {
core::intrinsics::assert_inhabited::<Never>();
core::intrinsics::assert_zero_valid::<&u8>();
@@ -20,7 +20,7 @@ pub fn panics() {
}
// Whether or not these asserts pass isn't known, so they shouldn't be modified.
-// EMIT_MIR intrinsic_asserts.generic.InstCombine.diff
+// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff
pub fn generic<T>() {
core::intrinsics::assert_inhabited::<T>();
core::intrinsics::assert_zero_valid::<T>();
diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff
index d98f75e75..46b450a4e 100644
--- a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff
+++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff
@@ -22,9 +22,9 @@
}
bb0: {
-+ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
+ _7 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
+ _8 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
++ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
StorageLive(_1); // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10
StorageLive(_2); // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14
_2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14
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 4086da520..25f472251 100644
--- a/tests/mir-opt/issue_72181_1.f.built.after.mir
+++ b/tests/mir-opt/issue_72181_1.f.built.after.mir
@@ -3,27 +3,13 @@
fn f(_1: Void) -> ! {
debug v => _1; // in scope 0 at $DIR/issue_72181_1.rs:+0:6: +0:7
let mut _0: !; // return place in scope 0 at $DIR/issue_72181_1.rs:+0:18: +0:19
- let mut _2: !; // in scope 0 at $DIR/issue_72181_1.rs:+0:20: +2:2
- let mut _3: !; // in scope 0 at $DIR/issue_72181_1.rs:+1:5: +1:15
bb0: {
- StorageLive(_2); // scope 0 at $DIR/issue_72181_1.rs:+0:20: +2:2
- StorageLive(_3); // scope 0 at $DIR/issue_72181_1.rs:+1:5: +1:15
FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/issue_72181_1.rs:+1:11: +1:12
unreachable; // scope 0 at $DIR/issue_72181_1.rs:+1:11: +1:12
}
bb1: {
- unreachable; // scope 0 at $DIR/issue_72181_1.rs:+1:5: +1:15
- }
-
- bb2: {
- StorageDead(_3); // scope 0 at $DIR/issue_72181_1.rs:+1:14: +1:15
- unreachable; // scope 0 at $DIR/issue_72181_1.rs:+0:20: +2:2
- }
-
- bb3: {
- StorageDead(_2); // scope 0 at $DIR/issue_72181_1.rs:+2:1: +2:2
return; // scope 0 at $DIR/issue_72181_1.rs:+2:2: +2:2
}
}
diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
index abb89b91d..73b9ea46c 100644
--- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
+++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff
@@ -21,9 +21,9 @@
let _13: &T; // in scope 1 at $DIR/issue_76432.rs:+3:18: +3:24
let _14: &T; // in scope 1 at $DIR/issue_76432.rs:+3:26: +3:32
scope 2 {
- debug v1 => _12; // in scope 2 at $DIR/issue_76432.rs:+3:10: +3:16
- debug v2 => _13; // in scope 2 at $DIR/issue_76432.rs:+3:18: +3:24
- debug v3 => _14; // in scope 2 at $DIR/issue_76432.rs:+3:26: +3:32
+ debug v1 => &(*_2)[0 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:10: +3:16
+ debug v2 => &(*_2)[1 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:18: +3:24
+ debug v3 => &(*_2)[2 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:26: +3:32
}
}
@@ -52,15 +52,6 @@
}
bb2: {
- StorageLive(_12); // scope 1 at $DIR/issue_76432.rs:+3:10: +3:16
- _12 = &(*_2)[0 of 3]; // scope 1 at $DIR/issue_76432.rs:+3:10: +3:16
- StorageLive(_13); // scope 1 at $DIR/issue_76432.rs:+3:18: +3:24
- _13 = &(*_2)[1 of 3]; // scope 1 at $DIR/issue_76432.rs:+3:18: +3:24
- StorageLive(_14); // scope 1 at $DIR/issue_76432.rs:+3:26: +3:32
- _14 = &(*_2)[2 of 3]; // scope 1 at $DIR/issue_76432.rs:+3:26: +3:32
- StorageDead(_14); // scope 1 at $DIR/issue_76432.rs:+3:84: +3:85
- StorageDead(_13); // scope 1 at $DIR/issue_76432.rs:+3:84: +3:85
- StorageDead(_12); // scope 1 at $DIR/issue_76432.rs:+3:84: +3:85
StorageDead(_5); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2
StorageDead(_2); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2
return; // scope 0 at $DIR/issue_76432.rs:+6:2: +6:2
diff --git a/tests/mir-opt/issue_78192.f.InstCombine.diff b/tests/mir-opt/issue_78192.f.InstSimplify.diff
index 116ca304c..914d7ceb2 100644
--- a/tests/mir-opt/issue_78192.f.InstCombine.diff
+++ b/tests/mir-opt/issue_78192.f.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `f` before InstCombine
-+ // MIR for `f` after InstCombine
+- // MIR for `f` before InstSimplify
++ // MIR for `f` after InstSimplify
fn f(_1: &T) -> *const T {
debug a => _1; // in scope 0 at $DIR/issue_78192.rs:+0:13: +0:14
diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs
index 39f665402..95142a3e4 100644
--- a/tests/mir-opt/issue_78192.rs
+++ b/tests/mir-opt/issue_78192.rs
@@ -8,4 +8,4 @@ fn main() {
f(&2);
}
-// EMIT_MIR issue_78192.f.InstCombine.diff
+// EMIT_MIR issue_78192.f.InstSimplify.diff
diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir
index 2324f5356..0424ce3ab 100644
--- a/tests/mir-opt/issue_99325.main.built.after.mir
+++ b/tests/mir-opt/issue_99325.main.built.after.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), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
-| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), const_param_did: Some(DefId(0:4 ~ issue_99325[22bb]::function_with_bytes::BYTES)) }, substs: [] }) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
+| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated([], DefId(0:8 ~ issue_99325[22bb]::main::{constant#1})) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">}
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/issue_99325.rs:+0:15: +0:15
diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
index 42b605326..9f955b471 100644
--- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
+++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir
@@ -4,31 +4,29 @@ fn num_to_digit(_1: char) -> u32 {
debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24
let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38
let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
- let mut _3: u32; // in scope 0 at $DIR/issue_59352.rs:+2:12: +2:23
scope 1 (inlined char::methods::<impl char>::is_digit) { // at $DIR/issue_59352.rs:15:12: 15:23
debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- debug radix => _3; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- let mut _4: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- let _5: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
+ debug radix => const 8_u32; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
+ let mut _3: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
+ let _4: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
scope 2 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL
- debug self => _4; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _6: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
+ debug self => _3; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _5: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
}
}
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { // at $DIR/issue_59352.rs:15:42: 15:50
debug self => _2; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _7: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- let mut _8: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _6: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+ let mut _7: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
scope 4 {
debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL
}
}
bb0: {
- StorageLive(_3); // scope 0 at $DIR/issue_59352.rs:+2:12: +2:23
+ StorageLive(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageLive(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- StorageLive(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
+ _4 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
@@ -43,8 +41,8 @@ fn num_to_digit(_1: char) -> u32 {
}
bb2: {
- _7 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
- switchInt(move _7) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+ _6 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+ switchInt(move _6) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
}
bb3: {
@@ -57,16 +55,15 @@ fn num_to_digit(_1: char) -> u32 {
}
bb5: {
- _4 = &_5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- _6 = discriminant((*_4)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
+ _3 = &_4; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
+ _5 = discriminant((*_3)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
+ StorageDead(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- StorageDead(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
- StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:12: +2:23
- switchInt(move _6) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
+ switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
}
bb6: {
- _8 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
+ _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/core/src/option.rs:LL:COL
// + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
index cc5079af7..b022e2ba4 100644
--- a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff
@@ -24,7 +24,7 @@
_4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56
- _3 = option_payload_ptr::<usize>(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:133:18: 133:54
+- // + span: $DIR/lower_intrinsics.rs:137:18: 137:54
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<usize>) -> *const usize {option_payload_ptr::<usize>}, val: Value(<ZST>) }
+ _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
+ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
@@ -37,7 +37,7 @@
_6 = &raw const (*_2); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56
- _5 = option_payload_ptr::<String>(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
- // mir::Constant
-- // + span: $DIR/lower_intrinsics.rs:134:18: 134:54
+- // + span: $DIR/lower_intrinsics.rs:138:18: 138:54
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<String>) -> *const String {option_payload_ptr::<String>}, val: Value(<ZST>) }
+ _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
+ goto -> bb2; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
new file mode 100644
index 000000000..60a1dd0ba
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff
@@ -0,0 +1,30 @@
+- // MIR for `ptr_offset` before LowerIntrinsics
++ // MIR for `ptr_offset` after LowerIntrinsics
+
+ fn ptr_offset(_1: *const i32, _2: isize) -> *const i32 {
+ debug p => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:26: +0:27
+ debug d => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:41: +0:42
+ let mut _0: *const i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:64
+ let mut _3: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
+ let mut _4: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
+
+ bb0: {
+ StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
+ _3 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31
+ StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
+ _4 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34
+- _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
+- // mir::Constant
+- // + span: $DIR/lower_intrinsics.rs:144:5: 144:29
+- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value(<ZST>) }
++ _0 = Offset(move _3, move _4); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35
+ }
+
+ bb1: {
+ StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35
+ StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35
+ return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs
index 33fef930a..0ca88a42e 100644
--- a/tests/mir-opt/lower_intrinsics.rs
+++ b/tests/mir-opt/lower_intrinsics.rs
@@ -124,13 +124,22 @@ pub fn read_via_copy_uninhabited(r: &Never) -> Never {
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) {
+ unsafe { core::intrinsics::write_via_move(r, v) }
+}
+
pub enum Never {}
// EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff
-#[cfg(not(bootstrap))]
pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
unsafe {
let _x = core::intrinsics::option_payload_ptr(o);
let _y = core::intrinsics::option_payload_ptr(p);
}
}
+
+// EMIT_MIR lower_intrinsics.ptr_offset.LowerIntrinsics.diff
+pub unsafe fn ptr_offset(p: *const i32, d: isize) -> *const i32 {
+ core::intrinsics::offset(p, d)
+}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
index 8735a7500..aa5d9619d 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff
@@ -3,26 +3,22 @@
fn transmute_to_box_uninhabited() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50
- let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2
- let _2: std::boxed::Box<Never>; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:16
+ let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
scope 1 {
- debug x => _2; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
+ debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
-- _2 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
+- _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:70:25: 70:44
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> Box<Never> {transmute::<usize, Box<Never>>}, val: Value(<ZST>) }
-+ _2 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
++ _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
}
bb1: {
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:5: +2:16
unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
index a77213277..5fafd45fe 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff
@@ -3,26 +3,22 @@
fn transmute_to_mut_uninhabited() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50
- let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2
- let _2: &mut Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:16
+ let _1: &mut Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
scope 1 {
- debug x => _2; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
+ debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
-- _2 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
+- _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:64:25: 64:44
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &mut Never {transmute::<usize, &mut Never>}, val: Value(<ZST>) }
-+ _2 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
++ _1 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52
}
bb1: {
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:5: +2:16
unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13
}
}
diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
index c4d53d4e8..08dead132 100644
--- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff
@@ -3,26 +3,22 @@
fn transmute_to_ref_uninhabited() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50
- let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2
- let _2: &Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
- let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:16
+ let _1: &Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
scope 1 {
- debug x => _2; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
+ debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10
}
bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
-- _2 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10
+- _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:58:21: 58:40
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &Never {transmute::<usize, &Never>}, val: Value(<ZST>) }
-+ _2 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
++ _1 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48
}
bb1: {
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:5: +2:16
unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13
}
}
diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
index c0cc698c4..28e45909c 100644
--- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff
@@ -3,16 +3,15 @@
fn unreachable() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26
- let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:27: +2:2
- let _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45
- let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45
+ let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45
+ let mut _2: !; // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45
scope 1 {
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:47
- StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
-- _3 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
+ StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:47
+ StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
+- _2 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:31:14: 31:43
- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value(<ZST>) }
diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff
index 0bfb34aca..217f27efe 100644
--- a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff
+++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff
@@ -30,10 +30,10 @@
_4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46
StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49
_5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49
-- _3 = wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
+- _3 = std::intrinsics::wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:9:14: 9:44
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_add::<i32>}, val: Value(<ZST>) }
+- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_add::<i32>}, val: Value(<ZST>) }
+ _3 = Add(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
+ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50
}
@@ -46,10 +46,10 @@
_7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:45: +2:46
StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49
_8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49
-- _6 = wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
+- _6 = std::intrinsics::wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
- // mir::Constant
- // + span: $DIR/lower_intrinsics.rs:10:14: 10:44
-- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_sub::<i32>}, val: Value(<ZST>) }
+- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_sub::<i32>}, val: Value(<ZST>) }
+ _6 = Sub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
+ goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50
}
diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
new file mode 100644
index 000000000..38d99f661
--- /dev/null
+++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff
@@ -0,0 +1,36 @@
+- // MIR for `write_via_move_string` before LowerIntrinsics
++ // MIR for `write_via_move_string` after LowerIntrinsics
+
+ fn write_via_move_string(_1: &mut String, _2: String) -> () {
+ debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:31
+ debug v => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:46: +0:47
+ let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:57: +0:57
+ let mut _3: *mut std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48
+ let mut _4: std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51
+ scope 1 {
+ }
+
+ bb0: {
+ StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
+ _3 = &raw mut (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48
+ StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51
+ _4 = move _2; // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51
+- _0 = write_via_move::<String>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
+- // mir::Constant
+- // + span: $DIR/lower_intrinsics.rs:129:14: 129:46
+- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*mut String, String) {write_via_move::<String>}, val: Value(<ZST>) }
++ (*_3) = move _4; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52
+ }
+
+ bb1: {
+ StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52
+ StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52
+ goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:1: +2:2
+ }
+
+ bb2: {
+ return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2
+ }
+ }
+
diff --git a/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir b/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir
deleted file mode 100644
index 4f5df1331..000000000
--- a/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir
+++ /dev/null
@@ -1,25 +0,0 @@
-// MIR for `f_u64` after PreCodegen
-
-fn f_u64() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics_e2e.rs:+0:16: +0:16
- let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21
- scope 1 (inlined f_dispatch::<u64>) { // at $DIR/lower_intrinsics_e2e.rs:15:5: 15:21
- debug t => _1; // in scope 1 at $DIR/lower_intrinsics_e2e.rs:19:22: 19:23
- let _2: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:23:9: 23:21
- scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/lower_intrinsics_e2e.rs:20:8: 20:32
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21
- _2 = f_non_zst::<u64>(const 0_u64) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics_e2e.rs:23:9: 23:21
- // mir::Constant
- // + span: $DIR/lower_intrinsics_e2e.rs:23:9: 23:18
- // + literal: Const { ty: fn(u64) {f_non_zst::<u64>}, val: Value(<ZST>) }
- }
-
- bb1: {
- StorageDead(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21
- return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2
- }
-}
diff --git a/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir b/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir
deleted file mode 100644
index 8654e80cd..000000000
--- a/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir
+++ /dev/null
@@ -1,22 +0,0 @@
-// MIR for `f_unit` after PreCodegen
-
-fn f_unit() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics_e2e.rs:+0:17: +0:17
- scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics_e2e.rs:9:5: 9:19
- debug t => const (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:19:22: 19:23
- let _1: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17
- scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics_e2e.rs:20:8: 20:32
- }
- }
-
- bb0: {
- _1 = f_zst::<()>(const ()) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17
- // mir::Constant
- // + span: $DIR/lower_intrinsics_e2e.rs:21:9: 21:14
- // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(<ZST>) }
- }
-
- bb1: {
- return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2
- }
-}
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 6cd6d8b77..be5baf6ee 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
@@ -1,39 +1,39 @@
// MIR for `use_x` 0 nll
| Free Region Mapping
-| '_#0r | Global | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r]
-| '_#1r | Local | ['_#1r, '_#4r]
-| '_#2r | Local | ['_#2r, '_#1r, '_#4r]
-| '_#3r | Local | ['_#4r, '_#3r]
-| '_#4r | Local | ['_#4r]
+| '?0 | Global | ['?2, '?1, '?0, '?4, '?3]
+| '?1 | Local | ['?1, '?4]
+| '?2 | Local | ['?2, '?1, '?4]
+| '?3 | Local | ['?4, '?3]
+| '?4 | Local | ['?4]
|
| Inferred Region Values
-| '_#0r | U0 | {bb0[0..=1], '_#0r, '_#1r, '_#2r, '_#3r, '_#4r}
-| '_#1r | U0 | {bb0[0..=1], '_#1r}
-| '_#2r | U0 | {bb0[0..=1], '_#2r}
-| '_#3r | U0 | {bb0[0..=1], '_#3r}
-| '_#4r | U0 | {bb0[0..=1], '_#4r}
-| '_#5r | U0 | {bb0[0..=1], '_#1r}
-| '_#6r | U0 | {bb0[0..=1], '_#2r}
-| '_#7r | U0 | {bb0[0..=1], '_#1r}
-| '_#8r | U0 | {bb0[0..=1], '_#3r}
+| '?0 | U0 | {bb0[0..=1], '?0, '?1, '?2, '?3, '?4}
+| '?1 | U0 | {bb0[0..=1], '?1}
+| '?2 | U0 | {bb0[0..=1], '?2}
+| '?3 | U0 | {bb0[0..=1], '?3}
+| '?4 | U0 | {bb0[0..=1], '?4}
+| '?5 | U0 | {bb0[0..=1], '?1}
+| '?6 | U0 | {bb0[0..=1], '?2}
+| '?7 | U0 | {bb0[0..=1], '?1}
+| '?8 | U0 | {bb0[0..=1], '?3}
|
| Inference Constraints
-| '_#0r live at {bb0[0..=1]}
-| '_#1r live at {bb0[0..=1]}
-| '_#2r live at {bb0[0..=1]}
-| '_#3r live at {bb0[0..=1]}
-| '_#4r live at {bb0[0..=1]}
-| '_#1r: '_#5r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0)
-| '_#1r: '_#7r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0)
-| '_#2r: '_#6r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0)
-| '_#3r: '_#8r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0)
-| '_#5r: '_#1r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0)
-| '_#6r: '_#2r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0)
-| '_#7r: '_#1r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0)
-| '_#8r: '_#3r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0)
+| '?0 live at {bb0[0..=1]}
+| '?1 live at {bb0[0..=1]}
+| '?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)
|
-fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool {
+fn use_x(_1: &'?5 mut i32, _2: &'?6 u32, _3: &'?7 u32, _4: &'?8 u32) -> bool {
debug w => _1; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:26: +0:27
debug x => _2; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:42: +0:43
debug y => _3; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:54: +0:55
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 798e45df8..c425f3cd5 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
@@ -1,28 +1,28 @@
// MIR for `main` 0 nll
| Free Region Mapping
-| '_#0r | Global | ['_#0r, '_#1r]
-| '_#1r | Local | ['_#1r]
+| '?0 | Global | ['?0, '?1]
+| '?1 | Local | ['?1]
|
| Inferred Region Values
-| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r}
-| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r}
-| '_#2r | U0 | {bb1[0..=7], bb2[0..=2]}
-| '_#3r | U0 | {bb1[1..=7], bb2[0..=2]}
-| '_#4r | U0 | {bb1[4..=7], bb2[0..=2]}
+| '?0 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?0, '?1}
+| '?1 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?1}
+| '?2 | U0 | {bb1[0..=7], bb2[0..=2]}
+| '?3 | U0 | {bb1[1..=7], bb2[0..=2]}
+| '?4 | U0 | {bb1[4..=7], bb2[0..=2]}
|
| Inference Constraints
-| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
-| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
-| '_#2r live at {bb1[0]}
-| '_#3r live at {bb1[1..=3]}
-| '_#4r live at {bb1[4..=7], bb2[0..=2]}
-| '_#2r: '_#3r due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0)
-| '_#3r: '_#4r due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0)
+| '?0 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
+| '?1 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
+| '?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)
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11
- let mut _1: [usize; Const(Value(Leaf(0x00000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
+ let mut _1: [usize; Const { ty: usize, kind: Leaf(0x00000003) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
@@ -32,10 +32,10 @@ fn main() -> () {
let _10: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
scope 1 {
debug v => _1; // in scope 1 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- let _2: &'_#3r usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
+ let _2: &'?3 usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
scope 2 {
debug p => _2; // in scope 2 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- let _6: &'_#4r usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
+ let _6: &'?4 usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
scope 3 {
debug q => _6; // in scope 3 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
}
@@ -55,7 +55,7 @@ fn main() -> () {
}
bb1: {
- _2 = &'_#2r _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18
+ _2 = &'?2 _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18
FakeRead(ForLet(None), _2); // bb1[1]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
StorageLive(_6); // bb1[2]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
_6 = _2; // bb1[3]: scope 2 at $DIR/region_subtyping_basic.rs:+3:13: +3:14
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 4767bfc76..22ad24f8d 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
@@ -1,28 +1,28 @@
// MIR for `main` 0 nll
| Free Region Mapping
-| '_#0r | Global | ['_#0r, '_#1r]
-| '_#1r | Local | ['_#1r]
+| '?0 | Global | ['?0, '?1]
+| '?1 | Local | ['?1]
|
| Inferred Region Values
-| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r}
-| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r}
-| '_#2r | U0 | {bb1[0..=7], bb2[0..=2]}
-| '_#3r | U0 | {bb1[1..=7], bb2[0..=2]}
-| '_#4r | U0 | {bb1[4..=7], bb2[0..=2]}
+| '?0 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?0, '?1}
+| '?1 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?1}
+| '?2 | U0 | {bb1[0..=7], bb2[0..=2]}
+| '?3 | U0 | {bb1[1..=7], bb2[0..=2]}
+| '?4 | U0 | {bb1[4..=7], bb2[0..=2]}
|
| Inference Constraints
-| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
-| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
-| '_#2r live at {bb1[0]}
-| '_#3r live at {bb1[1..=3]}
-| '_#4r live at {bb1[4..=7], bb2[0..=2]}
-| '_#2r: '_#3r due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0)
-| '_#3r: '_#4r due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0)
+| '?0 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
+| '?1 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]}
+| '?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)
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11
- let mut _1: [usize; Const(Value(Leaf(0x0000000000000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
+ let mut _1: [usize; Const { ty: usize, kind: Leaf(0x0000000000000003) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17
let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18
@@ -32,10 +32,10 @@ fn main() -> () {
let _10: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+7:9: +7:18
scope 1 {
debug v => _1; // in scope 1 at $DIR/region_subtyping_basic.rs:+1:9: +1:14
- let _2: &'_#3r usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
+ let _2: &'?3 usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
scope 2 {
debug p => _2; // in scope 2 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
- let _6: &'_#4r usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
+ let _6: &'?4 usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
scope 3 {
debug q => _6; // in scope 3 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
}
@@ -55,7 +55,7 @@ fn main() -> () {
}
bb1: {
- _2 = &'_#2r _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18
+ _2 = &'?2 _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18
FakeRead(ForLet(None), _2); // bb1[1]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10
StorageLive(_6); // bb1[2]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10
_6 = _2; // bb1[3]: scope 2 at $DIR/region_subtyping_basic.rs:+3:13: +3:14
diff --git a/tests/mir-opt/not_equal_false.opt.InstCombine.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
index b558c35ac..8e7776a0b 100644
--- a/tests/mir-opt/not_equal_false.opt.InstCombine.diff
+++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff
@@ -1,5 +1,5 @@
-- // MIR for `opt` before InstCombine
-+ // MIR for `opt` after InstCombine
+- // MIR for `opt` before InstSimplify
++ // MIR for `opt` after InstSimplify
fn opt(_1: bool) -> u32 {
debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:+0:8: +0:9
diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs
index 2ae03da40..e05607329 100644
--- a/tests/mir-opt/not_equal_false.rs
+++ b/tests/mir-opt/not_equal_false.rs
@@ -1,5 +1,5 @@
-// unit-test: InstCombine
-// EMIT_MIR not_equal_false.opt.InstCombine.diff
+// unit-test: InstSimplify
+// EMIT_MIR not_equal_false.opt.InstSimplify.diff
fn opt(x: bool) -> u32 {
if x != false { 0 } else { 1 }
diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs
new file mode 100644
index 000000000..a9f391b79
--- /dev/null
+++ b/tests/mir-opt/nrvo_miscompile_111005.rs
@@ -0,0 +1,22 @@
+// This is a miscompilation, #111005 to track
+
+// unit-test: RenameReturnPlace
+
+#![feature(custom_mir, core_intrinsics)]
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR nrvo_miscompile_111005.wrong.RenameReturnPlace.diff
+#[custom_mir(dialect = "runtime", phase = "initial")]
+pub fn wrong(arg: char) -> char {
+ mir!({
+ let temp = arg;
+ RET = temp;
+ temp = 'b';
+ Return()
+ })
+}
+
+fn main() {
+ assert_eq!(wrong('a'), 'a');
+}
diff --git a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff
new file mode 100644
index 000000000..a0acb6e7e
--- /dev/null
+++ b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff
@@ -0,0 +1,18 @@
+- // MIR for `wrong` before RenameReturnPlace
++ // MIR for `wrong` after RenameReturnPlace
+
+ fn wrong(_1: char) -> char {
+- let mut _0: char; // return place in scope 0 at $DIR/nrvo_miscompile_111005.rs:+0:28: +0:32
++ let mut _0: char; // return place in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _2: char; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+- _0 = _2; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+3:9: +3:19
+- _2 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19
++ _0 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
++ _0 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19
+ return; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+5:9: +5:17
+ }
+ }
+
diff --git a/tests/mir-opt/pre-codegen/README.md b/tests/mir-opt/pre-codegen/README.md
new file mode 100644
index 000000000..a338c18e0
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/README.md
@@ -0,0 +1,3 @@
+The goal of this directory is to track the quality of MIR that is given to codegen in a standard `-O` condiguration.
+
+As such, feel free to `--bless` whatever changes you get here, so long as doing so doesn't add substantially more MIR.
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
new file mode 100644
index 000000000..d8af6b14d
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
@@ -0,0 +1,17 @@
+// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0
+// ignore-debug: standard library debug assertions add a panic that breaks this optimization
+
+#![crate_type = "lib"]
+
+pub enum Thing {
+ A,
+ B,
+}
+
+// EMIT_MIR duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
+pub unsafe fn ub_if_b(t: Thing) -> Thing {
+ match t {
+ Thing::A => t,
+ Thing::B => std::hint::unreachable_unchecked(),
+ }
+}
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
new file mode 100644
index 000000000..0e885cf94
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
@@ -0,0 +1,27 @@
+// MIR for `ub_if_b` after PreCodegen
+
+fn ub_if_b(_1: Thing) -> Thing {
+ debug t => _1; // in scope 0 at $DIR/duplicate_switch_targets.rs:+0:23: +0:24
+ let mut _0: Thing; // return place in scope 0 at $DIR/duplicate_switch_targets.rs:+0:36: +0:41
+ let mut _2: isize; // in scope 0 at $DIR/duplicate_switch_targets.rs:+2:9: +2:17
+ scope 1 (inlined unreachable_unchecked) { // at $DIR/duplicate_switch_targets.rs:15:21: 15:55
+ scope 2 {
+ scope 3 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ }
+ }
+ }
+
+ bb0: {
+ _2 = discriminant(_1); // scope 0 at $DIR/duplicate_switch_targets.rs:+1:11: +1:12
+ switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/duplicate_switch_targets.rs:+1:5: +1:12
+ }
+
+ bb1: {
+ unreachable; // scope 2 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ }
+
+ bb2: {
+ _0 = move _1; // scope 0 at $DIR/duplicate_switch_targets.rs:+2:21: +2:22
+ return; // scope 0 at $DIR/duplicate_switch_targets.rs:+5:2: +5:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir
new file mode 100644
index 000000000..76e1fea2f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir
@@ -0,0 +1,26 @@
+// MIR for `f_u64` after PreCodegen
+
+fn f_u64() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/intrinsics.rs:+0:16: +0:16
+ let mut _1: u64; // in scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
+ scope 1 (inlined f_dispatch::<u64>) { // at $DIR/intrinsics.rs:19:5: 19:21
+ debug t => const 0_u64; // in scope 1 at $DIR/intrinsics.rs:23:22: 23:23
+ let _2: (); // in scope 1 at $DIR/intrinsics.rs:27:9: 27:21
+ scope 2 (inlined std::mem::size_of::<u64>) { // at $DIR/intrinsics.rs:24:8: 24:32
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
+ _1 = const 0_u64; // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
+ _2 = f_non_zst::<u64>(move _1) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/intrinsics.rs:27:9: 27:21
+ // mir::Constant
+ // + span: $DIR/intrinsics.rs:27:9: 27:18
+ // + literal: Const { ty: fn(u64) {f_non_zst::<u64>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_1); // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21
+ return; // scope 0 at $DIR/intrinsics.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir
new file mode 100644
index 000000000..3d416de34
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir
@@ -0,0 +1,22 @@
+// MIR for `f_unit` after PreCodegen
+
+fn f_unit() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/intrinsics.rs:+0:17: +0:17
+ scope 1 (inlined f_dispatch::<()>) { // at $DIR/intrinsics.rs:13:5: 13:19
+ debug t => const (); // in scope 1 at $DIR/intrinsics.rs:23:22: 23:23
+ let _1: (); // in scope 1 at $DIR/intrinsics.rs:25:9: 25:17
+ scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/intrinsics.rs:24:8: 24:32
+ }
+ }
+
+ bb0: {
+ _1 = f_zst::<()>(const ()) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/intrinsics.rs:25:9: 25:17
+ // mir::Constant
+ // + span: $DIR/intrinsics.rs:25:9: 25:14
+ // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/intrinsics.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/lower_intrinsics_e2e.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index 872ef59b0..ecdb656cb 100644
--- a/tests/mir-opt/lower_intrinsics_e2e.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,16 +1,20 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
// Checks that we do not have any branches in the MIR for the two tested functions.
// compile-flags: -Cpanic=abort
#![feature(core_intrinsics)]
#![crate_type = "lib"]
-// EMIT_MIR lower_intrinsics_e2e.f_unit.PreCodegen.after.mir
+// EMIT_MIR intrinsics.f_unit.PreCodegen.after.mir
pub fn f_unit() {
f_dispatch(());
}
-// EMIT_MIR lower_intrinsics_e2e.f_u64.PreCodegen.after.mir
+// EMIT_MIR intrinsics.f_u64.PreCodegen.after.mir
pub fn f_u64() {
f_dispatch(0u64);
}
diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir
new file mode 100644
index 000000000..1d2387102
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir
@@ -0,0 +1,16 @@
+// MIR for `manual_replace` after PreCodegen
+
+fn manual_replace(_1: &mut u32, _2: u32) -> u32 {
+ debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:23: +0:24
+ debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:36: +0:37
+ let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:47: +0:50
+ scope 1 {
+ debug temp => _0; // in scope 1 at $DIR/mem_replace.rs:+1:9: +1:13
+ }
+
+ bb0: {
+ _0 = (*_1); // scope 0 at $DIR/mem_replace.rs:+1:16: +1:18
+ (*_1) = _2; // scope 1 at $DIR/mem_replace.rs:+2:5: +2:11
+ return; // scope 0 at $DIR/mem_replace.rs:+4:2: +4:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
new file mode 100644
index 000000000..50e0538c1
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir
@@ -0,0 +1,53 @@
+// MIR for `mem_replace` after PreCodegen
+
+fn mem_replace(_1: &mut u32, _2: u32) -> u32 {
+ debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:20: +0:21
+ debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:33: +0:34
+ let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:44: +0:47
+ scope 1 (inlined std::mem::replace::<u32>) { // at $DIR/mem_replace.rs:16:5: 16:28
+ debug dest => _1; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ debug src => _2; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ let mut _3: *const u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ let mut _4: *mut u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ scope 2 {
+ scope 3 {
+ debug result => _0; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ scope 7 (inlined std::ptr::write::<u32>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ debug dst => _4; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ debug src => _2; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ let mut _6: *mut u32; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 8 {
+ scope 9 (inlined std::ptr::write::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug dst => _6; // in scope 9 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ }
+ }
+ }
+ }
+ scope 4 (inlined std::ptr::read::<u32>) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ debug src => _3; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ let mut _5: *const u32; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 5 {
+ scope 6 (inlined std::ptr::read::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug src => _5; // in scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ _3 = &raw const (*_1); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ _0 = (*_3); // scope 5 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageDead(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ _4 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageLive(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ (*_4) = _2; // scope 8 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ StorageDead(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ StorageDead(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL
+ return; // scope 0 at $DIR/mem_replace.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs
new file mode 100644
index 000000000..e5066c38b
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -0,0 +1,17 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
+#![crate_type = "lib"]
+
+// EMIT_MIR mem_replace.manual_replace.PreCodegen.after.mir
+pub fn manual_replace(r: &mut u32, v: u32) -> u32 {
+ let temp = *r;
+ *r = v;
+ temp
+}
+
+// EMIT_MIR mem_replace.mem_replace.PreCodegen.after.mir
+pub fn mem_replace(r: &mut u32, v: u32) -> u32 {
+ std::mem::replace(r, v)
+}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff
index 691aa01a5..691aa01a5 100644
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff
index 691aa01a5..691aa01a5 100644
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir
new file mode 100644
index 000000000..7886bf19e
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after PreCodegen
+
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
+ scope 1 {
+ debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
+ scope 2 {
+ debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
+ scope 3 {
+ debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
+ }
+ }
+ }
+
+ bb0: {
+ return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir
new file mode 100644
index 000000000..7886bf19e
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after PreCodegen
+
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
+ scope 1 {
+ debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
+ scope 2 {
+ debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
+ scope 3 {
+ debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
+ }
+ }
+ }
+
+ bb0: {
+ return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
+ }
+}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff
index 98cd020da..98cd020da 100644
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff
index 98cd020da..98cd020da 100644
--- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir
new file mode 100644
index 000000000..5bea94c7f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after SimplifyLocals-final
+
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
+ scope 1 {
+ debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
+ scope 2 {
+ debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
+ scope 3 {
+ debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
+ }
+ }
+ }
+
+ bb0: {
+ return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir
new file mode 100644
index 000000000..5bea94c7f
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir
@@ -0,0 +1,18 @@
+// MIR for `main` after SimplifyLocals-final
+
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11
+ scope 1 {
+ debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10
+ scope 2 {
+ debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10
+ scope 3 {
+ debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10
+ }
+ }
+ }
+
+ bb0: {
+ return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2
+ }
+}
diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
index 5ffa15347..bb32cd3af 100644
--- a/tests/mir-opt/const_prop/optimizes_into_variable.rs
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -1,5 +1,4 @@
// ignore-wasm32 compiled with panic=abort by default
-// unit-test
// compile-flags: -C overflow-checks=on
struct Point {
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir
new file mode 100644
index 000000000..343a4a5a6
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir
@@ -0,0 +1,91 @@
+// MIR for `forward_loop` after PreCodegen
+
+fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
+ debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:21: +0:26
+ debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:33: +0:36
+ debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:43: +0:44
+ let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:60: +0:60
+ let mut _4: std::ops::Range<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ let mut _5: std::ops::Range<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ let mut _8: &mut std::ops::Range<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6
+ let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10
+ let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13
+ scope 1 {
+ debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:24
+ let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10
+ scope 2 {
+ debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10
+ }
+ scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { // at $DIR/range_iter.rs:21:14: 21:24
+ debug self => _8; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ }
+ }
+ scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:21:14: 21:24
+ debug self => _4; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ }
+
+ bb0: {
+ _4 = std::ops::Range::<u32> { start: _1, end: _2 }; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24
+ goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
+ }
+
+ bb1: {
+ StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
+ _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
+ _7 = <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<u32>) -> Option<<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10
+ StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
+ _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
+ StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
+ _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
+ _6 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
+ // mir::Constant
+ // + span: $DIR/range_iter.rs:22:9: 22:10
+ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> <impl Fn(u32) as FnOnce<(u32,)>>::Output {<impl Fn(u32) as Fn<(u32,)>>::call}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
+ }
+
+ bb4: {
+ StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
+ StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6
+ drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
+ }
+
+ bb5: {
+ StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
+ StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
+ StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
+ goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
+ }
+
+ bb6: {
+ return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2
+ }
+
+ bb7 (cleanup): {
+ drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
+ }
+
+ bb8 (cleanup): {
+ resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2
+ }
+
+ bb9: {
+ _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
+ switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir
new file mode 100644
index 000000000..f45eabba2
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir
@@ -0,0 +1,95 @@
+// MIR for `inclusive_loop` after PreCodegen
+
+fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
+ debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:23: +0:28
+ debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:35: +0:38
+ debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:45: +0:46
+ let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:62: +0:62
+ let mut _4: std::ops::RangeInclusive<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ let mut _5: std::ops::RangeInclusive<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ let mut _8: &mut std::ops::RangeInclusive<u32>; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6
+ let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10
+ let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13
+ scope 1 {
+ debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:25
+ let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10
+ scope 2 {
+ debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10
+ }
+ scope 5 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { // at $DIR/range_iter.rs:28:14: 28:25
+ debug self => _8; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ }
+ }
+ scope 3 (inlined RangeInclusive::<u32>::new) { // at $DIR/range_iter.rs:28:14: 28:25
+ debug start => _1; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL
+ debug end => _2; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL
+ }
+ scope 4 (inlined <RangeInclusive<u32> as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:28:14: 28:25
+ debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ }
+
+ bb0: {
+ _4 = RangeInclusive::<u32> { start: _1, end: _2, exhausted: const false }; // scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL
+ StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:25
+ goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
+ }
+
+ bb1: {
+ StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
+ _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
+ _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive<u32>) -> Option<<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::Item> {<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10
+ StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
+ _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10
+ StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
+ _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
+ _6 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13
+ // mir::Constant
+ // + span: $DIR/range_iter.rs:29:9: 29:10
+ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> <impl Fn(u32) as FnOnce<(u32,)>>::Output {<impl Fn(u32) as Fn<(u32,)>>::call}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
+ }
+
+ bb4: {
+ StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
+ StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6
+ drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
+ }
+
+ bb5: {
+ StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
+ StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13
+ StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6
+ goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6
+ }
+
+ bb6: {
+ return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2
+ }
+
+ bb7 (cleanup): {
+ drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2
+ }
+
+ bb8 (cleanup): {
+ resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2
+ }
+
+ bb9: {
+ _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
+ switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir
new file mode 100644
index 000000000..d013b1b94
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir
@@ -0,0 +1,20 @@
+// MIR for `range_inclusive_iter_next` after PreCodegen
+
+fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> {
+ debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:34: +0:36
+ let mut _0: std::option::Option<u32>; // return place in scope 0 at $DIR/range_iter.rs:+0:67: +0:78
+ scope 1 (inlined iter::range::<impl Iterator for RangeInclusive<u32>>::next) { // at $DIR/range_iter.rs:16:8: 16:14
+ debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ }
+
+ bb0: {
+ _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive<u32>) -> Option<<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::Item> {<RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir
new file mode 100644
index 000000000..cae46e2b0
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir
@@ -0,0 +1,20 @@
+// MIR for `range_iter_next` after PreCodegen
+
+fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
+ debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:24: +0:26
+ let mut _0: std::option::Option<u32>; // return place in scope 0 at $DIR/range_iter.rs:+0:48: +0:59
+ scope 1 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { // at $DIR/range_iter.rs:11:8: 11:14
+ debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ }
+
+ bb0: {
+ _0 = <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next(_1) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
+ // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range<u32>) -> Option<<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs
new file mode 100644
index 000000000..fe21d4dfd
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -0,0 +1,31 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
+#![crate_type = "lib"]
+
+use std::ops::{Range, RangeInclusive};
+
+// EMIT_MIR range_iter.range_iter_next.PreCodegen.after.mir
+pub fn range_iter_next(it: &mut Range<u32>) -> Option<u32> {
+ it.next()
+}
+
+// EMIT_MIR range_iter.range_inclusive_iter_next.PreCodegen.after.mir
+pub fn range_inclusive_iter_next(it: &mut RangeInclusive<u32>) -> Option<u32> {
+ it.next()
+}
+
+// EMIT_MIR range_iter.forward_loop.PreCodegen.after.mir
+pub fn forward_loop(start: u32, end: u32, f: impl Fn(u32)) {
+ for x in start..end {
+ f(x)
+ }
+}
+
+// EMIT_MIR range_iter.inclusive_loop.PreCodegen.after.mir
+pub fn inclusive_loop(start: u32, end: u32, f: impl Fn(u32)) {
+ for x in start..=end {
+ f(x)
+ }
+}
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
new file mode 100644
index 000000000..986ab3588
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -0,0 +1,56 @@
+// MIR for `ezmap` after PreCodegen
+
+fn ezmap(_1: Option<i32>) -> Option<i32> {
+ debug x => _1; // in scope 0 at $DIR/simple_option_map.rs:+0:14: +0:15
+ let mut _0: std::option::Option<i32>; // return place in scope 0 at $DIR/simple_option_map.rs:+0:33: +0:44
+ let mut _6: i32; // in scope 0 at $DIR/simple_option_map.rs:11:25: 11:29
+ scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map.rs:18:12: 18:15]>) { // at $DIR/simple_option_map.rs:18:5: 18:22
+ debug slf => _1; // in scope 1 at $DIR/simple_option_map.rs:6:17: 6:20
+ debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15]; // in scope 1 at $DIR/simple_option_map.rs:6:33: 6:34
+ let mut _2: isize; // in scope 1 at $DIR/simple_option_map.rs:11:9: 11:16
+ let _3: i32; // in scope 1 at $DIR/simple_option_map.rs:11:14: 11:15
+ let mut _4: i32; // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29
+ let mut _5: (i32,); // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29
+ scope 2 {
+ debug x => _3; // in scope 2 at $DIR/simple_option_map.rs:11:14: 11:15
+ scope 3 (inlined ezmap::{closure#0}) { // at $DIR/simple_option_map.rs:11:25: 11:29
+ debug n => _6; // in scope 3 at $DIR/simple_option_map.rs:+1:13: +1:14
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22
+ _2 = discriminant(_1); // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14
+ switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map.rs:10:5: 10:14
+ }
+
+ bb1: {
+ _0 = Option::<i32>::None; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21
+ goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21
+ }
+
+ bb2: {
+ unreachable; // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14
+ }
+
+ bb3: {
+ _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map.rs:11:14: 11:15
+ StorageLive(_4); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
+ StorageLive(_5); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
+ _5 = (move _3,); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
+ StorageLive(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
+ _6 = move (_5.0: i32); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
+ _4 = Add(_6, const 1_i32); // scope 3 at $DIR/simple_option_map.rs:+1:16: +1:21
+ StorageDead(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29
+ StorageDead(_5); // scope 2 at $DIR/simple_option_map.rs:11:28: 11:29
+ _0 = Option::<i32>::Some(move _4); // scope 2 at $DIR/simple_option_map.rs:11:20: 11:30
+ StorageDead(_4); // scope 2 at $DIR/simple_option_map.rs:11:29: 11:30
+ goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:14:1: 14:2
+ }
+
+ bb4: {
+ StorageDead(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22
+ return; // scope 0 at $DIR/simple_option_map.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/simple_option_map_e2e.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index 2acd2a227..fb3da68e4 100644
--- a/tests/mir-opt/simple_option_map_e2e.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,3 +1,7 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
#[inline(always)]
fn map<T, U, F>(slf: Option<T>, f: F) -> Option<U>
where
@@ -9,7 +13,7 @@ where
}
}
-// EMIT_MIR simple_option_map_e2e.ezmap.PreCodegen.after.mir
+// EMIT_MIR simple_option_map.ezmap.PreCodegen.after.mir
pub fn ezmap(x: Option<i32>) -> Option<i32> {
map(x, |n| n + 1)
}
diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs
new file mode 100644
index 000000000..44b456276
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -0,0 +1,27 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
+#![crate_type = "lib"]
+
+use std::ops::Range;
+
+// EMIT_MIR slice_index.slice_index_usize.PreCodegen.after.mir
+pub fn slice_index_usize(slice: &[u32], index: usize) -> u32 {
+ slice[index]
+}
+
+// EMIT_MIR slice_index.slice_get_mut_usize.PreCodegen.after.mir
+pub fn slice_get_mut_usize(slice: &mut [u32], index: usize) -> Option<&mut u32> {
+ slice.get_mut(index)
+}
+
+// EMIT_MIR slice_index.slice_index_range.PreCodegen.after.mir
+pub fn slice_index_range(slice: &[u32], index: Range<usize>) -> &[u32] {
+ &slice[index]
+}
+
+// EMIT_MIR slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
+pub unsafe fn slice_get_unchecked_mut_range(slice: &mut [u32], index: Range<usize>) -> &mut [u32] {
+ slice.get_unchecked_mut(index)
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir
new file mode 100644
index 000000000..715a1e3fc
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir
@@ -0,0 +1,105 @@
+// MIR for `slice_get_mut_usize` after PreCodegen
+
+fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
+ debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:28: +0:33
+ debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:47: +0:52
+ let mut _0: std::option::Option<&mut u32>; // return place in scope 0 at $DIR/slice_index.rs:+0:64: +0:80
+ scope 1 (inlined core::slice::<impl [u32]>::get_mut::<usize>) { // at $DIR/slice_index.rs:16:11: 16:25
+ debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ debug self => _2; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug slice => _1; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _3: bool; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _4: usize; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _5: &[u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _6: &mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _7: *mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _8: *mut [u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ scope 3 {
+ scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _2; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug slice => _8; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _9: *mut u32; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _10: usize; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ let mut _11: *mut [u32]; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 5 {
+ debug this => _2; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ scope 6 {
+ scope 7 (inlined <usize as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug this => _10; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug slice => _11; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _11; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ let mut _12: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug ptr => _12; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ scope 10 {
+ }
+ }
+ }
+ }
+ scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _8; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ }
+ scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _9; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug count => _2; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 13 {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _5 = &(*_1); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _4 = Len((*_5)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _3 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ }
+
+ bb1: {
+ StorageLive(_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _8 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _9 = _8 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ _7 = Offset(_9, _2); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _6 = &mut (*_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _0 = Option::<&mut u32>::Some(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ }
+
+ bb2: {
+ _0 = const Option::<&mut u32>::None; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: Option<&mut u32>, val: Value(Scalar(0x0000000000000000)) }
+ goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ }
+
+ bb3: {
+ StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
new file mode 100644
index 000000000..7a10b929e
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir
@@ -0,0 +1,134 @@
+// MIR for `slice_get_unchecked_mut_range` after PreCodegen
+
+fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> &mut [u32] {
+ debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:45: +0:50
+ debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:64: +0:69
+ let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:88: +0:98
+ scope 1 (inlined core::slice::<impl [u32]>::get_unchecked_mut::<std::ops::Range<usize>>) { // at $DIR/slice_index.rs:26:11: 26:35
+ debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ let mut _3: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ let mut _4: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ scope 2 {
+ scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ debug self => _2; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug slice => _4; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let _5: std::ops::Range<usize>; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _7: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _8: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _9: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _10: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _11: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _12: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let mut _13: std::ops::Range<usize>; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ let mut _14: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 4 {
+ debug this => _5; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ scope 5 {
+ let _6: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ scope 6 {
+ debug new_len => _6; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ }
+ scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _10; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug count => _11; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 13 {
+ }
+ }
+ scope 14 (inlined slice_from_raw_parts_mut::<u32>) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug data => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ debug len => _12; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ let mut _16: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ debug self => _9; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ }
+ scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ debug data_address => _16; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ debug metadata => _12; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ let mut _17: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ let mut _18: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ let mut _19: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ scope 17 {
+ }
+ }
+ }
+ }
+ scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug this => _13; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug slice => _14; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug self => _14; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ scope 10 {
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _4 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _7 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _8 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _6 = unchecked_sub::<usize>(move _7, move _8) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL
+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::<usize>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _10 = _4 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _11 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _9 = Offset(_10, _11); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _12 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageLive(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ _16 = _9 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ StorageLive(_17); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ StorageLive(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ StorageLive(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ _19 = _16 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ _18 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _19, metadata: _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ StorageDead(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ _17 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _18 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ StorageDead(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ _3 = (_17.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ StorageDead(_17); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL
+ StorageDead(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _0 = &mut (*_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir
new file mode 100644
index 000000000..dcf79a4a4
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir
@@ -0,0 +1,26 @@
+// MIR for `slice_index_range` after PreCodegen
+
+fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
+ debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31
+ debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46
+ let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:65: +0:71
+ scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) { // at $DIR/slice_index.rs:21:6: 21:18
+ debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ let _3: &[u32]; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ }
+
+ bb0: {
+ StorageLive(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, _1) -> bb1; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL
+ // + literal: Const { ty: for<'a> fn(std::ops::Range<usize>, &'a [u32]) -> &'a <std::ops::Range<usize> as SliceIndex<[u32]>>::Output {<std::ops::Range<usize> as SliceIndex<[u32]>>::index}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ _0 = _3; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL
+ return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir
new file mode 100644
index 000000000..6cc0ee057
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir
@@ -0,0 +1,20 @@
+// MIR for `slice_index_usize` after PreCodegen
+
+fn slice_index_usize(_1: &[u32], _2: usize) -> u32 {
+ debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31
+ debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46
+ let mut _0: u32; // return place in scope 0 at $DIR/slice_index.rs:+0:58: +0:61
+ let mut _3: usize; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17
+ let mut _4: bool; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17
+
+ bb0: {
+ _3 = Len((*_1)); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
+ _4 = Lt(_2, _3); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
+ assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> bb1; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
+ }
+
+ bb1: {
+ _0 = (*_1)[_2]; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17
+ return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
new file mode 100644
index 000000000..0da7e5536
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir
@@ -0,0 +1,203 @@
+// MIR for `forward_loop` after PreCodegen
+
+fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
+ debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33
+ debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45
+ let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60
+ let mut _3: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ let _5: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ let mut _6: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ let mut _7: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
+ let mut _10: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
+ let mut _11: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13
+ scope 1 {
+ debug iter => _4; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ let _9: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+ scope 2 {
+ debug x => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:28:20: 28:26
+ debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _14: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _15: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _17: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _18: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _19: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 5 {
+ debug ptr => _12; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 6 {
+ let _13: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 7 {
+ debug end => _13; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug ptr => _18; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ let mut _21: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ let mut _22: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug ptr => _22; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ debug self => _22; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ let mut _23: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 17 {
+ scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug ptr => _23; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug self => _23; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 20 {
+ scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug self => _23; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug addr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ scope 10 {
+ }
+ }
+ scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug self => _12; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ debug count => _16; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ let mut _20: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26
+ debug self => _3; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ }
+
+ bb0: {
+ StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _20 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _12 = move _20 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _14 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ switchInt(move _14) -> [0: bb11, otherwise: bb10]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ }
+
+ bb1: {
+ StorageLive(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ _7 = &mut _4; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ _6 = <std::slice::Iter<'_, T> as Iterator>::next(_7) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ // mir::Constant
+ // + span: $DIR/slice_iter.rs:28:14: 28:26
+ // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as Iterator>::next}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ _8 = discriminant(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ }
+
+ bb3: {
+ _9 = ((_6 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+ StorageLive(_10); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+ _10 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+ StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+ _11 = (_9,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+ _5 = <impl Fn(&T) as Fn<(&T,)>>::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+ // mir::Constant
+ // + span: $DIR/slice_iter.rs:29:9: 29:10
+ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> <impl Fn(&T) as FnOnce<(&T,)>>::Output {<impl Fn(&T) as Fn<(&T,)>>::call}, val: Value(<ZST>) }
+ }
+
+ bb4: {
+ unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26
+ }
+
+ bb5: {
+ StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+ StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
+ drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
+ }
+
+ bb6: {
+ StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
+ StorageDead(_10); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
+ StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+ goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
+ }
+
+ bb7: {
+ return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2
+ }
+
+ bb8 (cleanup): {
+ drop(_2) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
+ }
+
+ bb9 (cleanup): {
+ resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2
+ }
+
+ bb10: {
+ StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _15 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _13 = _15 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ }
+
+ bb11: {
+ StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _13 = Offset(_12, _16); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ }
+
+ bb12: {
+ StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _18 = _12 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _21 = _18 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ _17 = NonNull::<T> { pointer: _21 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _19 = _13; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _3 = std::slice::Iter::<'_, T> { ptr: move _17, end: move _19, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
+ // adt
+ // + user_ty: UserType(1)
+ StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ _4 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
new file mode 100644
index 000000000..45b41b54c
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir
@@ -0,0 +1,220 @@
+// MIR for `reverse_loop` after PreCodegen
+
+fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
+ debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33
+ debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45
+ let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60
+ let mut _3: std::iter::Rev<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ let mut _5: std::iter::Rev<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ let _6: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ let mut _7: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ let mut _8: &mut std::iter::Rev<std::slice::Iter<'_, T>>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ let mut _9: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6
+ let mut _11: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10
+ let mut _12: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13
+ scope 1 {
+ debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
+ let _10: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+ scope 2 {
+ debug x => _10; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10
+ }
+ scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32
+ debug self => _8; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ let mut _25: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ }
+ }
+ scope 3 (inlined core::slice::<impl [T]>::iter) { // at $DIR/slice_iter.rs:35:20: 35:26
+ debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let _13: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _15: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _17: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _18: std::ptr::NonNull<T>; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _19: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ let mut _20: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 5 {
+ debug ptr => _13; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 6 {
+ let _14: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 7 {
+ debug end => _14; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ scope 13 (inlined NonNull::<T>::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug ptr => _19; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ let mut _22: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ let mut _23: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 14 {
+ scope 15 (inlined NonNull::<T>::new_unchecked::runtime::<T>) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ debug ptr => _23; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL
+ scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ debug self => _23; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 17 {
+ scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ scope 20 {
+ scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 9 (inlined invalid::<T>) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug addr => _16; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ scope 10 {
+ }
+ }
+ scope 11 (inlined ptr::const_ptr::<impl *const T>::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug self => _13; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ debug count => _17; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ scope 12 {
+ }
+ }
+ }
+ }
+ scope 8 (inlined core::slice::<impl [T]>::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ let mut _21: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ }
+ }
+ }
+ scope 22 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32
+ debug self => _4; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+ scope 23 (inlined Rev::<std::slice::Iter<'_, T>>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+ debug iter => _4; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ }
+ }
+ scope 24 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32
+ debug self => _3; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ }
+
+ bb0: {
+ StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26
+ StorageLive(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _21 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _13 = move _21 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageDead(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _15 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ switchInt(move _15) -> [0: bb10, otherwise: bb9]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ }
+
+ bb1: {
+ StorageLive(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
+ _8 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
+ StorageLive(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ _25 = &mut ((*_8).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ _7 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _25) -> [return: bb12, unwind: bb7]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ _10 = ((_7 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10
+ StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+ _11 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10
+ StorageLive(_12); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+ _12 = (_10,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+ _6 = <impl Fn(&T) as Fn<(&T,)>>::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13
+ // mir::Constant
+ // + span: $DIR/slice_iter.rs:36:9: 36:10
+ // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> <impl Fn(&T) as FnOnce<(&T,)>>::Output {<impl Fn(&T) as Fn<(&T,)>>::call}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
+ }
+
+ bb4: {
+ StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+ StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6
+ drop(_2) -> bb6; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
+ }
+
+ bb5: {
+ StorageDead(_12); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
+ StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13
+ StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6
+ goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
+ }
+
+ bb6: {
+ return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2
+ }
+
+ bb7 (cleanup): {
+ drop(_2) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2
+ }
+
+ bb8 (cleanup): {
+ resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2
+ }
+
+ bb9: {
+ StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _14 = _16 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ }
+
+ bb10: {
+ StorageLive(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _17 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _14 = Offset(_13, _17); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ StorageDead(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ }
+
+ bb11: {
+ StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _19 = _13 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _22 = _19 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ _18 = NonNull::<T> { pointer: _22 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
+ StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageLive(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _20 = _14; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ _4 = std::slice::Iter::<'_, T> { ptr: move _18, end: move _20, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: PhantomData<&T>, val: Value(<ZST>) }
+ // adt
+ // + user_ty: UserType(1)
+ StorageDead(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL
+ StorageDead(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL
+ _3 = Rev::<std::slice::Iter<'_, T>> { iter: move _4 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32
+ StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ _5 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32
+ goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6
+ }
+
+ bb12: {
+ StorageDead(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL
+ _9 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
+ switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
new file mode 100644
index 000000000..ca423ca55
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -0,0 +1,38 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
+#![crate_type = "lib"]
+
+// When this test was added, the MIR for `next` was 174 lines just for the basic
+// blocks -- far more if you counted the scopes. The goal of having this here
+// is to hopefully keep it a reasonable size, ideally eventually small enough
+// that the mir inliner would actually be willing to inline it, since it's an
+// important building block and usually very few *backend* instructions.
+
+// As such, feel free to `--bless` whatever changes you get here, so long as
+// doing so doesn't add substantially more MIR.
+
+// EMIT_MIR slice_iter.slice_iter_next.PreCodegen.after.mir
+pub fn slice_iter_next<'a, T>(it: &mut std::slice::Iter<'a, T>) -> Option<&'a T> {
+ it.next()
+}
+
+// EMIT_MIR slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir
+pub fn slice_iter_mut_next_back<'a, T>(it: &mut std::slice::IterMut<'a, T>) -> Option<&'a mut T> {
+ it.next_back()
+}
+
+// EMIT_MIR slice_iter.forward_loop.PreCodegen.after.mir
+pub fn forward_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) {
+ for x in slice.iter() {
+ f(x)
+ }
+}
+
+// EMIT_MIR slice_iter.reverse_loop.PreCodegen.after.mir
+pub fn reverse_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) {
+ for x in slice.iter().rev() {
+ f(x)
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir
new file mode 100644
index 000000000..a1431d473
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir
@@ -0,0 +1,17 @@
+// MIR for `slice_iter_mut_next_back` after PreCodegen
+
+fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> {
+ debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:40: +0:42
+ let mut _0: std::option::Option<&mut T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:80: +0:97
+
+ bb0: {
+ _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:19
+ // mir::Constant
+ // + span: $DIR/slice_iter.rs:23:8: 23:17
+ // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, T>) -> Option<<std::slice::IterMut<'_, T> as Iterator>::Item> {<std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir
new file mode 100644
index 000000000..d2a963cad
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir
@@ -0,0 +1,17 @@
+// MIR for `slice_iter_next` after PreCodegen
+
+fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> {
+ debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:33
+ let mut _0: std::option::Option<&T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:68: +0:81
+
+ bb0: {
+ _0 = <std::slice::Iter<'_, T> as Iterator>::next(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:14
+ // mir::Constant
+ // + span: $DIR/slice_iter.rs:18:8: 18:12
+ // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option<<std::slice::Iter<'_, T> as Iterator>::Item> {<std::slice::Iter<'_, T> as Iterator>::next}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2
+ }
+}
diff --git a/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir
index 935dbb28b..53971b4cf 100644
--- a/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir
@@ -1,66 +1,70 @@
// MIR for `new` after PreCodegen
fn new(_1: Result<T, E>) -> Result<T, E> {
- debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15
- let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46
- let mut _2: std::ops::ControlFlow<E, T>; // in scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
- let mut _3: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:22
- let _4: T; // in scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21
- let _5: E; // in scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22
- let mut _6: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+8:13: +8:37
- let _7: T; // in scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36
- let _8: E; // in scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33
+ debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15
+ let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46
+ let mut _2: std::ops::ControlFlow<E, T>; // in scope 0 at $DIR/try_identity.rs:+2:15: +7:10
+ let mut _3: isize; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:22
+ let _4: T; // in scope 0 at $DIR/try_identity.rs:+4:20: +4:21
+ let _5: E; // in scope 0 at $DIR/try_identity.rs:+5:21: +5:22
+ let mut _6: isize; // in scope 0 at $DIR/try_identity.rs:+8:13: +8:37
+ let _7: T; // in scope 0 at $DIR/try_identity.rs:+8:35: +8:36
+ let _8: E; // in scope 0 at $DIR/try_identity.rs:+9:32: +9:33
scope 1 {
- debug v => _4; // in scope 1 at $DIR/try_identity_e2e.rs:+4:20: +4:21
+ debug v => _4; // in scope 1 at $DIR/try_identity.rs:+4:20: +4:21
}
scope 2 {
- debug e => _5; // in scope 2 at $DIR/try_identity_e2e.rs:+5:21: +5:22
+ debug e => _5; // in scope 2 at $DIR/try_identity.rs:+5:21: +5:22
}
scope 3 {
- debug v => _7; // in scope 3 at $DIR/try_identity_e2e.rs:+8:35: +8:36
+ debug v => _7; // in scope 3 at $DIR/try_identity.rs:+8:35: +8:36
}
scope 4 {
- debug e => _8; // in scope 4 at $DIR/try_identity_e2e.rs:+9:32: +9:33
+ debug e => _8; // in scope 4 at $DIR/try_identity.rs:+9:32: +9:33
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
- _3 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:20
+ StorageLive(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10
+ _3 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+3:19: +3:20
+ switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+3:13: +3:20
}
bb1: {
- _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22
- _2 = ControlFlow::<E, T>::Break(move _5); // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48
- goto -> bb4; // scope 0 at $DIR/try_identity_e2e.rs:+5:47: +5:48
+ _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+5:21: +5:22
+ _2 = ControlFlow::<E, T>::Break(move _5); // scope 2 at $DIR/try_identity.rs:+5:27: +5:48
+ goto -> bb4; // scope 0 at $DIR/try_identity.rs:+5:47: +5:48
}
bb2: {
- unreachable; // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20
+ unreachable; // scope 0 at $DIR/try_identity.rs:+3:19: +3:20
}
bb3: {
- _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21
- _2 = ControlFlow::<E, T>::Continue(move _4); // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50
- goto -> bb4; // scope 0 at $DIR/try_identity_e2e.rs:+4:49: +4:50
+ _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+4:20: +4:21
+ _2 = ControlFlow::<E, T>::Continue(move _4); // scope 1 at $DIR/try_identity.rs:+4:26: +4:50
+ goto -> bb4; // scope 0 at $DIR/try_identity.rs:+4:49: +4:50
}
bb4: {
- _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10
- switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10
+ _6 = discriminant(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10
+ switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +7:10
}
bb5: {
- _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33
- _0 = Result::<T, E>::Err(move _8); // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51
- StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
- return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
+ _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity.rs:+9:32: +9:33
+ _0 = Result::<T, E>::Err(move _8); // scope 4 at $DIR/try_identity.rs:+9:45: +9:51
+ StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
+ goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
}
bb6: {
- _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36
- _0 = Result::<T, E>::Ok(move _7); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6
- StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
- return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2
+ _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity.rs:+8:35: +8:36
+ _0 = Result::<T, E>::Ok(move _7); // scope 0 at $DIR/try_identity.rs:+1:5: +11:6
+ StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
+ goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2
+ }
+
+ bb7: {
+ return; // scope 0 at $DIR/try_identity.rs:+12:2: +12:2
}
}
diff --git a/tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir
index d88ae5ac9..e217d1994 100644
--- a/tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir
@@ -1,36 +1,40 @@
// MIR for `old` after PreCodegen
fn old(_1: Result<T, E>) -> Result<T, E> {
- debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15
- let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46
- let mut _2: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:18
- let _3: T; // in scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17
- let _4: E; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18
+ debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15
+ let mut _0: std::result::Result<T, E>; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46
+ let mut _2: isize; // in scope 0 at $DIR/try_identity.rs:+3:13: +3:18
+ let _3: T; // in scope 0 at $DIR/try_identity.rs:+3:16: +3:17
+ let _4: E; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:18
scope 1 {
- debug v => _3; // in scope 1 at $DIR/try_identity_e2e.rs:+3:16: +3:17
+ debug v => _3; // in scope 1 at $DIR/try_identity.rs:+3:16: +3:17
}
scope 2 {
- debug e => _4; // in scope 2 at $DIR/try_identity_e2e.rs:+4:17: +4:18
+ debug e => _4; // in scope 2 at $DIR/try_identity.rs:+4:17: +4:18
}
bb0: {
- _2 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16
- switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +2:16
+ _2 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+2:15: +2:16
+ switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +2:16
}
bb1: {
- _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18
- _0 = Result::<T, E>::Err(move _4); // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36
- return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2
+ _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+4:17: +4:18
+ _0 = Result::<T, E>::Err(move _4); // scope 2 at $DIR/try_identity.rs:+4:30: +4:36
+ goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2
}
bb2: {
- unreachable; // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16
+ unreachable; // scope 0 at $DIR/try_identity.rs:+2:15: +2:16
}
bb3: {
- _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17
- _0 = Result::<T, E>::Ok(move _3); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6
- return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2
+ _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+3:16: +3:17
+ _0 = Result::<T, E>::Ok(move _3); // scope 0 at $DIR/try_identity.rs:+1:5: +6:6
+ goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2
+ }
+
+ bb4: {
+ return; // scope 0 at $DIR/try_identity.rs:+7:2: +7:2
}
}
diff --git a/tests/mir-opt/try_identity_e2e.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index 00cb80f50..079ecccab 100644
--- a/tests/mir-opt/try_identity_e2e.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,9 +1,13 @@
+// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
+// only-64bit
+// ignore-debug
+
// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings
// of that syntax.
use std::ops::ControlFlow;
-// EMIT_MIR try_identity_e2e.new.PreCodegen.after.mir
+// EMIT_MIR try_identity.new.PreCodegen.after.mir
fn new<T, E>(x: Result<T, E>) -> Result<T, E> {
Ok(
match {
@@ -18,7 +22,7 @@ fn new<T, E>(x: Result<T, E>) -> Result<T, E> {
)
}
-// EMIT_MIR try_identity_e2e.old.PreCodegen.after.mir
+// EMIT_MIR try_identity.old.PreCodegen.after.mir
fn old<T, E>(x: Result<T, E>) -> Result<T, E> {
Ok(
match x {
diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
new file mode 100644
index 000000000..07bd48fc8
--- /dev/null
+++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff
@@ -0,0 +1,175 @@
+- // MIR for `debuginfo` before ReferencePropagation
++ // MIR for `debuginfo` after ReferencePropagation
+
+ fn debuginfo() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:16: +0:16
+ let _1: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+3:9: +3:19
+ let mut _2: u8; // in scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
+ let _4: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+4:18: +4:22
+ let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +12:6
+ let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/reference_prop.rs:+9:11: +9:18
+ let mut _8: isize; // in scope 0 at $DIR/reference_prop.rs:+10:9: +10:13
+ let _10: (); // in scope 0 at $DIR/reference_prop.rs:+16:5: +17:6
+ let mut _11: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:82: +16:94
+ let _12: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:94
+ let mut _13: &[i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
+ let _14: [i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
+ let mut _15: std::ops::RangeFull; // in scope 0 at $DIR/reference_prop.rs:+16:91: +16:93
+ let mut _16: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
+ let mut _17: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
+ let mut _18: bool; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
+ let _23: &&mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:28: +19:40
+ let _24: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:29: +19:40
+ let mut _25: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+19:34: +19:38
+ scope 1 {
+- debug ref_mut_u8 => _1; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19
++ debug ref_mut_u8 => &_2; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19
+ let _3: &u8; // in scope 1 at $DIR/reference_prop.rs:+4:9: +4:14
+ let mut _28: &debuginfo::T; // in scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
+ scope 2 {
+- debug field => _3; // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
++ debug field => &((*_28).0: u8); // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
+ let _5: &u8; // in scope 2 at $DIR/reference_prop.rs:+7:9: +7:17
+ scope 3 {
+- debug reborrow => _5; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17
++ debug reborrow => &_2; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17
+ let _9: &i32; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
+ let _22: &&&mut u8; // in scope 3 at $DIR/reference_prop.rs:+19:9: +19:24
+ let mut _27: &std::option::Option<i32>; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
+ scope 4 {
+- debug variant_field => _9; // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
++ debug variant_field => &(((*_27) as Some).0: i32); // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
+ }
+ scope 5 {
+- debug constant_index => _19; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
++ debug constant_index => &(*_11)[1 of 3]; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
+ debug subslice => _20; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
+ debug constant_index_from_end => _21; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
+ let _19: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
+ let _20: &[i32]; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
+ let _21: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
+ let mut _26: &[i32; 10]; // in scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
+ }
+ scope 6 {
+- debug multiple_borrow => _22; // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24
++ debug multiple_borrow => &&&(_25.0: u8); // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+3:9: +3:19
+ StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
+ _2 = const 5_u8; // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
+- _1 = &mut _2; // scope 0 at $DIR/reference_prop.rs:+3:22: +3:31
+- StorageLive(_3); // scope 1 at $DIR/reference_prop.rs:+4:9: +4:14
+ _28 = const _; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:535:17: 535:24
+ // + literal: Const { ty: &T, val: Unevaluated(debuginfo, [], Some(promoted[2])) }
+- _3 = &((*_28).0: u8); // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
+- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+7:9: +7:17
+- _5 = &(*_1); // scope 2 at $DIR/reference_prop.rs:+7:20: +7:32
+- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+9:5: +12:6
+ StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
+ _7 = Option::<i32>::Some(const 0_i32); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
+ _8 = discriminant(_7); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
+ switchInt(move _8) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 3 at $DIR/reference_prop.rs:+9:5: +9:18
+ }
+
+ bb1: {
+- StorageLive(_9); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
+ _27 = const _; // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:542:14: 542:31
+ // + literal: Const { ty: &Option<i32>, val: Unevaluated(debuginfo, [], Some(promoted[1])) }
+- _9 = &(((*_27) as Some).0: i32); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
+- _6 = const (); // scope 4 at $DIR/reference_prop.rs:+11:36: +11:38
+- StorageDead(_9); // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38
+ goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38
+ }
+
+ bb2: {
+ unreachable; // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18
+ }
+
+ bb3: {
+- _6 = const (); // scope 3 at $DIR/reference_prop.rs:+10:17: +10:19
+ goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+10:17: +10:19
+ }
+
+ bb4: {
+ StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6
+- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6
+- StorageLive(_10); // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
+ StorageLive(_11); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
+ StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
+ StorageLive(_13); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
+ _26 = const _; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:547:83: 547:90
+ // + literal: Const { ty: &[i32; 10], val: Unevaluated(debuginfo, [], Some(promoted[0])) }
+ _13 = &(*_26); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
+ StorageLive(_15); // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
+ _15 = RangeFull; // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
+ _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> bb5; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:547:83: 547:94
+ // + literal: Const { ty: for<'a> fn(&'a [i32; 10], RangeFull) -> &'a <[i32; 10] as Index<RangeFull>>::Output {<[i32; 10] as Index<RangeFull>>::index}, val: Value(<ZST>) }
+ }
+
+ bb5: {
+ StorageDead(_15); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
+ StorageDead(_13); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
+ _11 = &(*_12); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
+ _16 = Len((*_11)); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
+ _17 = const 3_usize; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
+ _18 = Ge(move _16, move _17); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
+ switchInt(move _18) -> [0: bb7, otherwise: bb6]; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
+ }
+
+ bb6: {
+- StorageLive(_19); // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
+- _19 = &(*_11)[1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
+ StorageLive(_20); // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
+ _20 = &(*_11)[2:-1]; // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
+ StorageLive(_21); // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
+ _21 = &(*_11)[-1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
+- _10 = const (); // scope 5 at $DIR/reference_prop.rs:+16:95: +17:6
+ StorageDead(_21); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
+ StorageDead(_20); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
+- StorageDead(_19); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
+ goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
+ }
+
+ bb7: {
+- _10 = const (); // scope 3 at $DIR/reference_prop.rs:+17:6: +17:6
+ goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
+ }
+
+ bb8: {
+ StorageDead(_12); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
+ StorageDead(_11); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
+- StorageDead(_10); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
+- StorageLive(_22); // scope 3 at $DIR/reference_prop.rs:+19:9: +19:24
+- StorageLive(_23); // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40
+- StorageLive(_24); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40
+ StorageLive(_25); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38
+ _25 = T(const 6_u8); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38
+- _24 = &mut (_25.0: u8); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40
+- _23 = &_24; // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40
+- _22 = &_23; // scope 3 at $DIR/reference_prop.rs:+19:27: +19:40
+ _0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:16: +20:2
+ StorageDead(_25); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
+- StorageDead(_24); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
+- StorageDead(_23); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
+- StorageDead(_22); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
+- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+20:1: +20:2
+- StorageDead(_3); // scope 1 at $DIR/reference_prop.rs:+20:1: +20:2
+ StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2
+- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2
+ return; // scope 0 at $DIR/reference_prop.rs:+20:2: +20:2
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff
new file mode 100644
index 000000000..e158f64e9
--- /dev/null
+++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff
@@ -0,0 +1,38 @@
+- // MIR for `dominate_storage` before ReferencePropagation
++ // MIR for `dominate_storage` after ReferencePropagation
+
+ fn dominate_storage() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23
+ let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _4: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _5: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ goto -> bb1; // scope 0 at $DIR/reference_prop.rs:+8:11: +8:20
+ }
+
+ bb1: {
+ _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18
+ _2 = &_1; // scope 0 at $DIR/reference_prop.rs:+11:13: +11:19
+ goto -> bb2; // scope 0 at $DIR/reference_prop.rs:+12:13: +12:22
+ }
+
+ bb2: {
+ _5 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _0 = opaque::<i32>(_5) -> bb3; // scope 0 at $DIR/reference_prop.rs:+16:13: +16:38
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:455:28: 455:34
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+19:13: +19:27
+ StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27
+ _6 = const true; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ switchInt(_6) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:47
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff
new file mode 100644
index 000000000..38ab16ced
--- /dev/null
+++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff
@@ -0,0 +1,56 @@
+- // MIR for `maybe_dead` before ReferencePropagation
++ // MIR for `maybe_dead` after ReferencePropagation
+
+ fn maybe_dead(_1: bool) -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:24: +0:24
+ let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _4: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _5: &mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _6: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _8: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+7:13: +7:27
+ StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+8:13: +8:27
+ _2 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+9:13: +9:18
+ _3 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18
+ _4 = &_2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _5 = &mut _3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ (*_5) = const 7_i32; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:19
+- _6 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
++ _6 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ switchInt(_1) -> [1: bb1, otherwise: bb2]; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:46
+ }
+
+ bb1: {
+ StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27
+ StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+21:13: +21:27
+ _0 = opaque::<i32>(_6) -> bb2; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:38
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:489:28: 489:34
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ _7 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _0 = opaque::<i32>(_7) -> bb3; // scope 0 at $DIR/reference_prop.rs:+27:13: +27:38
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:494:28: 494:34
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ _8 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _0 = opaque::<i32>(_8) -> bb4; // scope 0 at $DIR/reference_prop.rs:+33:13: +33:43
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:500:33: 500:39
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb4: {
+ return; // scope 0 at $DIR/reference_prop.rs:+36:13: +36:21
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff
new file mode 100644
index 000000000..6e4517868
--- /dev/null
+++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff
@@ -0,0 +1,27 @@
+- // MIR for `multiple_storage` before ReferencePropagation
++ // MIR for `multiple_storage` after ReferencePropagation
+
+ fn multiple_storage() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23
+ let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+6:13: +6:27
+ _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+7:13: +7:18
+ _2 = &_1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:13: +9:27
+ StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:27
+ _3 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _0 = opaque::<i32>(_3) -> bb1; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:43
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:429:33: 429:39
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ return; // scope 0 at $DIR/reference_prop.rs:+18:13: +18:21
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
new file mode 100644
index 000000000..d99e11035
--- /dev/null
+++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
@@ -0,0 +1,75 @@
+- // MIR for `mut_raw_then_mut_shr` before ReferencePropagation
++ // MIR for `mut_raw_then_mut_shr` after ReferencePropagation
+
+ fn mut_raw_then_mut_shr() -> (i32, i32) {
+ let mut _0: (i32, i32); // return place in scope 0 at $DIR/reference_prop.rs:+0:30: +0:40
+ let mut _1: i32; // in scope 0 at $DIR/reference_prop.rs:+1:9: +1:14
+ let mut _4: *mut i32; // in scope 0 at $DIR/reference_prop.rs:+3:16: +3:36
+ let mut _5: &mut i32; // in scope 0 at $DIR/reference_prop.rs:+3:16: +3:26
+ let _8: (); // in scope 0 at $DIR/reference_prop.rs:+7:5: +7:26
+ let mut _9: i32; // in scope 0 at $DIR/reference_prop.rs:+8:6: +8:7
+ let mut _10: i32; // in scope 0 at $DIR/reference_prop.rs:+8:9: +8:10
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:14
+ let _2: &mut i32; // in scope 1 at $DIR/reference_prop.rs:+2:9: +2:13
+ scope 2 {
+- debug xref => _2; // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
++ debug xref => &_1; // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13
+ let _3: *mut i32; // in scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
+ scope 3 {
+- debug xraw => _3; // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
++ debug xraw => &_1; // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13
+ let _6: &i32; // in scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
+ scope 4 {
+- debug xshr => _6; // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
++ debug xshr => &_1; // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13
+ let _7: i32; // in scope 4 at $DIR/reference_prop.rs:+6:9: +6:10
+ scope 5 {
+ debug a => _7; // in scope 5 at $DIR/reference_prop.rs:+6:9: +6:10
+ scope 6 {
+ }
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+1:9: +1:14
+ _1 = const 2_i32; // scope 0 at $DIR/reference_prop.rs:+1:17: +1:18
+- StorageLive(_2); // scope 1 at $DIR/reference_prop.rs:+2:9: +2:13
+- _2 = &mut _1; // scope 1 at $DIR/reference_prop.rs:+2:16: +2:22
+- StorageLive(_3); // scope 2 at $DIR/reference_prop.rs:+3:9: +3:13
+- StorageLive(_4); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
+- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
+- _5 = &mut (*_2); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
+- _4 = &raw mut (*_5); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26
+- _3 = _4; // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36
+- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37
+- StorageDead(_4); // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37
+- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+4:9: +4:13
+- _6 = &(*_2); // scope 3 at $DIR/reference_prop.rs:+4:16: +4:22
+ StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:10
+- _7 = (*_6); // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18
+- StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+7:5: +7:26
+- (*_3) = const 4_i32; // scope 6 at $DIR/reference_prop.rs:+7:14: +7:23
+- _8 = const (); // scope 6 at $DIR/reference_prop.rs:+7:5: +7:26
+- StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+7:25: +7:26
++ _7 = _1; // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18
++ _1 = const 4_i32; // scope 6 at $DIR/reference_prop.rs:+7:14: +7:23
+ StorageLive(_9); // scope 5 at $DIR/reference_prop.rs:+8:6: +8:7
+ _9 = _7; // scope 5 at $DIR/reference_prop.rs:+8:6: +8:7
+ StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+8:9: +8:10
+ _10 = _1; // scope 5 at $DIR/reference_prop.rs:+8:9: +8:10
+ _0 = (move _9, move _10); // scope 5 at $DIR/reference_prop.rs:+8:5: +8:11
+ StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11
+ StorageDead(_9); // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11
+ StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+9:1: +9:2
+- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+9:1: +9:2
+- StorageDead(_3); // scope 2 at $DIR/reference_prop.rs:+9:1: +9:2
+- StorageDead(_2); // scope 1 at $DIR/reference_prop.rs:+9:1: +9:2
+ StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:1: +9:2
+ return; // scope 0 at $DIR/reference_prop.rs:+9:2: +9:2
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff
new file mode 100644
index 000000000..75c1f8f57
--- /dev/null
+++ b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff
@@ -0,0 +1,23 @@
+- // MIR for `read_through_raw` before ReferencePropagation
++ // MIR for `read_through_raw` after ReferencePropagation
+
+ fn read_through_raw(_1: &mut usize) -> usize {
+ let mut _0: usize; // return place in scope 0 at $DIR/reference_prop.rs:+0:39: +0:44
+ let mut _2: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _4: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _5: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+- _2 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:25
+- _3 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:26
+- _4 = &raw mut (*_2); // scope 0 at $DIR/reference_prop.rs:+12:13: +12:30
+- _5 = &raw mut (*_3); // scope 0 at $DIR/reference_prop.rs:+13:13: +13:30
+- _0 = (*_4); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22
+- _0 = (*_5); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22
++ _0 = (*_1); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22
++ _0 = (*_1); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22
+ return; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:21
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
new file mode 100644
index 000000000..7b31ee695
--- /dev/null
+++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff
@@ -0,0 +1,475 @@
+- // MIR for `reference_propagation` before ReferencePropagation
++ // MIR for `reference_propagation` after ReferencePropagation
+
+ fn reference_propagation(_1: &T, _2: &T) -> () {
+ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:39: +0:45
+ debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:54: +0:66
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:75: +0:75
+ let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ let _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:14
+ let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
+ let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
+ let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ let _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:14
+ let mut _13: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16
+ let _14: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16
+ let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
+ let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
+ let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ let _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:14
+ let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+ let mut _24: &&usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
+ let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ let _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:14
+ let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+ let mut _31: *mut &usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
+ let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ let _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:14
+ let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
+ let mut _37: &usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
+ let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ let _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:14
+ let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
+ let mut _46: &usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
+ let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+ let _48: &T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
+ let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
+ let _52: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ let _53: &T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
+ let mut _54: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28
+ let _55: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28
+ let _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
+ let mut _58: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
+ let _59: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ let _60: usize; // in scope 0 at $DIR/reference_prop.rs:+76:13: +76:14
+ let _64: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
+ let mut _65: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
+ let _66: usize; // in scope 0 at $DIR/reference_prop.rs:+85:13: +85:14
+ let _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
+ let mut _71: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ scope 1 {
+ debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
+ let _5: &usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+ scope 2 {
+- debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
++ debug b => &_4; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+ let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
+ scope 3 {
+ debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ }
+ }
+ }
+ scope 4 {
+ debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:14
+ let _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:15
+ scope 5 {
+ debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:15
+ let mut _12: &usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
+ scope 6 {
+ debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18
+ let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
+ scope 7 {
+ debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14
+ }
+ }
+ }
+ }
+ scope 8 {
+ debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:14
+ let _20: &usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
+ scope 9 {
+ debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14
+ let _21: &&usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
+ scope 10 {
+ debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14
+ let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
+ scope 11 {
+ debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14
+ }
+ }
+ }
+ }
+ scope 12 {
+ debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:14
+ let mut _27: &usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
+ scope 13 {
+ debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18
+ let _28: *mut &usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+ scope 14 {
+ debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14
+ let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
+ scope 15 {
+ debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14
+ }
+ }
+ }
+ }
+ scope 16 {
+ debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:14
+ let _34: &usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
+ scope 17 {
+ debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14
+ let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
+ scope 18 {
+ debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14
+ }
+ }
+ }
+ scope 19 {
+ debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:14
+ let _40: &usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
+ scope 20 {
+ debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15
+ let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
+ scope 21 {
+ debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14
+ let _42: &usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
+ scope 22 {
+ debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15
+ let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
+ scope 23 {
+ debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15
+ let _44: &usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
+ scope 24 {
+ debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 25 {
+- debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
++ debug a => _1; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
+ scope 26 {
+ debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14
+ }
+ }
+ scope 27 {
+ debug a => _53; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14
+ let _56: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
+ scope 28 {
+ debug b => _56; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14
+ }
+ }
+ scope 29 {
+ debug a => _60; // in scope 29 at $DIR/reference_prop.rs:+76:13: +76:14
+ let _61: &usize; // in scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
+ scope 30 {
+- debug b => _61; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
++ debug b => &_60; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
+ let _62: &&usize; // in scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
+ scope 31 {
+- debug d => _62; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
++ debug d => &&_60; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
+ let _63: usize; // in scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
+ scope 32 {
+ debug c => _63; // in scope 32 at $DIR/reference_prop.rs:+79:13: +79:14
+ }
+ }
+ }
+ }
+ scope 33 {
+ debug a => _66; // in scope 33 at $DIR/reference_prop.rs:+85:13: +85:14
+ let mut _67: &usize; // in scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
+ scope 34 {
+- debug b => _67; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
++ debug b => &_66; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
+ let _68: &mut &usize; // in scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
+ scope 35 {
+- debug d => _68; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
++ debug d => &&_66; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
+ let _69: usize; // in scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
+ scope 36 {
+ debug c => _69; // in scope 36 at $DIR/reference_prop.rs:+88:13: +88:14
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:14
+ _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:17: +3:24
+- StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+- _5 = &_4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19
+ StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
+- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
++ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
+ StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
+ StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
+ _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
+ _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:16:9: 16:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19
+ StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20
+- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
+ StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:14
+ _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:17: +11:24
+ StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:15
+ _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:18: +12:25
+ StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
+ _12 = &_10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:23
+ StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
+- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
+- _14 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
+- _13 = &(*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
++ _13 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16
+ _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:16
+ StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:15: +14:16
+- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:16: +14:17
+ StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
+ _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19
+ StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
+ StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
+ _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
+ _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:27:9: 27:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19
+ StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20
+- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:14
+ _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:17: +22:24
+ StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
+ _20 = &_19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:19
+ StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
+ _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19
+ StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
+ _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19
+ StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
+ StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+ _24 = _21; // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+ _23 = opaque::<&&usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:36:9: 36:15
+ // + literal: Const { ty: fn(&&usize) {opaque::<&&usize>}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18
+ StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
+- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:14
+ _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:17: +31:24
+ StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
+ _27 = &_26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:23
+ StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+ _28 = &raw mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27
+ StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
+ _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19
+ StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
+ StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+ _31 = _28; // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+ _30 = opaque::<*mut &usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:45:9: 45:15
+ // + literal: Const { ty: fn(*mut &usize) {opaque::<*mut &usize>}, val: Value(<ZST>) }
+ }
+
+ bb4: {
+ StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18
+ StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
+- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:14
+ _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:17: +40:24
+ StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
+ _34 = &_33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:19
+ StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
+- _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19
++ _35 = _33; // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19
+ StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
+ StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
+ _37 = _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
+ _36 = opaque::<&usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:53:9: 53:15
+ // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value(<ZST>) }
+ }
+
+ bb5: {
+ StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18
+ StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19
+- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:14
+ _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:17: +48:24
+ StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
+ _40 = &_39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:20
+ StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
+- _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20
++ _41 = _39; // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20
+ StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
+ _42 = _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20
+ StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
+- _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21
++ _43 = _39; // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21
+ StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
+ _44 = _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20
+ StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
+ StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
+ _46 = _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
+ _45 = opaque::<&usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:66:9: 66:15
+ // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value(<ZST>) }
+ }
+
+ bb6: {
+ StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19
+ StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20
+- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+- StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
+- _48 = &(*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:25
+ StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
+- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
++ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
+ StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
+ StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
+ _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
+ _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:73:9: 73:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb7: {
+ StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19
+ StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20
+- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+ StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageLive(_53); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
+ _53 = &(*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:27
+ StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
+- StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
+- _55 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
+- _54 = &(*_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
++ _54 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28
+ _2 = move _54; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:28
+ StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:27: +69:28
+- StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+69:28: +69:29
+ StorageLive(_56); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
+ _56 = (*_53); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19
+ StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
+ StorageLive(_58); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
+ _58 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
+ _57 = opaque::<()>(move _58) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:81:9: 81:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb8: {
+ StorageDead(_58); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19
+ StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20
+- _52 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageDead(_56); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6
+ StorageDead(_53); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageLive(_59); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageLive(_60); // scope 0 at $DIR/reference_prop.rs:+76:13: +76:14
+ _60 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+76:17: +76:24
+- StorageLive(_61); // scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
+- _61 = &_60; // scope 29 at $DIR/reference_prop.rs:+77:17: +77:19
+- StorageLive(_62); // scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
+- _62 = &_61; // scope 30 at $DIR/reference_prop.rs:+78:17: +78:19
+ StorageLive(_63); // scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
+- _63 = (*_61); // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
++ _63 = _60; // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
+ StorageLive(_64); // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
+ StorageLive(_65); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
+ _65 = (); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
+ _64 = opaque::<()>(move _65) -> bb9; // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:90:9: 90:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb9: {
+ StorageDead(_65); // scope 32 at $DIR/reference_prop.rs:+80:18: +80:19
+ StorageDead(_64); // scope 32 at $DIR/reference_prop.rs:+80:19: +80:20
+- _59 = const (); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageDead(_63); // scope 31 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_62); // scope 30 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_61); // scope 29 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageDead(_60); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_59); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageLive(_66); // scope 0 at $DIR/reference_prop.rs:+85:13: +85:14
+ _66 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+85:17: +85:24
+- StorageLive(_67); // scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
+- _67 = &_66; // scope 33 at $DIR/reference_prop.rs:+86:21: +86:23
+- StorageLive(_68); // scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
+- _68 = &mut _67; // scope 34 at $DIR/reference_prop.rs:+87:17: +87:23
+ StorageLive(_69); // scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
+- _69 = (*_67); // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
++ _69 = _66; // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
+ StorageLive(_70); // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
+ StorageLive(_71); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
+ _71 = (); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
+ _70 = opaque::<()>(move _71) -> bb10; // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:99:9: 99:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb10: {
+ StorageDead(_71); // scope 36 at $DIR/reference_prop.rs:+89:18: +89:19
+ StorageDead(_70); // scope 36 at $DIR/reference_prop.rs:+89:19: +89:20
+ _0 = const (); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
+ StorageDead(_69); // scope 35 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_68); // scope 34 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_67); // scope 33 at $DIR/reference_prop.rs:+90:5: +90:6
+ StorageDead(_66); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6
+ return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
new file mode 100644
index 000000000..ddeb04e50
--- /dev/null
+++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
@@ -0,0 +1,536 @@
+- // MIR for `reference_propagation_const_ptr` before ReferencePropagation
++ // MIR for `reference_propagation_const_ptr` after ReferencePropagation
+
+ fn reference_propagation_const_ptr(_1: *const T, _2: *const T) -> () {
+ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:45: +0:51
+ debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:63: +0:75
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87
+ let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
+ let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
+ let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ let mut _13: *const usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:26
+ let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
+ let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
+ let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+ let mut _23: &*const usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
+ let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+ let mut _30: *mut *const usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
+ let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
+ let mut _36: *const usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
+ let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
+ let mut _45: *const usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
+ let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+ let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
+ let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
+ let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ let mut _53: *const T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:38
+ let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
+ let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
+ let _57: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ let _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
+ let mut _63: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
+ let _64: (); // in scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
+ let _69: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
+ let mut _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ let _75: (); // in scope 0 at $DIR/reference_prop.rs:+98:9: +98:19
+ let mut _76: (); // in scope 0 at $DIR/reference_prop.rs:+98:16: +98:18
+ scope 1 {
+ let _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
+ scope 2 {
+ debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
+ let _5: *const usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+ scope 3 {
+- debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
++ debug b => &_4; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
+ let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ scope 4 {
+ debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14
+ }
+ }
+ }
+ }
+ scope 5 {
+ let _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:14
+ scope 6 {
+ debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:14
+ let _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:15
+ scope 7 {
+ debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:15
+ let mut _12: *const usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
+ scope 8 {
+ debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18
+ let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
+ scope 9 {
+ debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14
+ }
+ }
+ }
+ }
+ }
+ scope 10 {
+ let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14
+ scope 11 {
+ debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:14
+ let _19: *const usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
+ scope 12 {
+ debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14
+ let _20: &*const usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
+ scope 13 {
+ debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14
+ let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
+ scope 14 {
+ debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14
+ }
+ }
+ }
+ }
+ }
+ scope 15 {
+ let _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14
+ scope 16 {
+ debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:14
+ let mut _26: *const usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
+ scope 17 {
+ debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18
+ let _27: *mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+ scope 18 {
+ debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14
+ let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
+ scope 19 {
+ debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14
+ }
+ }
+ }
+ }
+ }
+ scope 20 {
+ let _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:14
+ scope 21 {
+ debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:14
+ let _33: *const usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
+ scope 22 {
+ debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14
+ let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
+ scope 23 {
+ debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14
+ }
+ }
+ }
+ }
+ scope 24 {
+ let _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:14
+ scope 25 {
+ debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:14
+ let _39: *const usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
+ scope 26 {
+ debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15
+ let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
+ scope 27 {
+ debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14
+ let _41: *const usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
+ scope 28 {
+ debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15
+ let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
+ scope 29 {
+ debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15
+ let _43: *const usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
+ scope 30 {
+ debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 31 {
+ let _47: *const T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+ scope 32 {
+- debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
++ debug a => _1; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
+ scope 33 {
+ debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14
+ }
+ }
+ }
+ scope 34 {
+ let _52: *const T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
+ scope 35 {
+ debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14
+ let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
+ scope 36 {
+ debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14
+ }
+ }
+ }
+ scope 37 {
+ let _58: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:14
+ scope 38 {
+ debug a => _58; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:14
+ let _59: *const usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+ scope 39 {
+- debug b => _59; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
++ debug b => &_58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
+ let _60: *const usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+ scope 40 {
+- debug c => _60; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
++ debug c => &_58; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
+ let _61: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
+ scope 41 {
+ debug e => _61; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14
+ }
+ }
+ }
+ }
+ }
+ scope 42 {
+ let _65: usize; // in scope 42 at $DIR/reference_prop.rs:+85:13: +85:14
+ scope 43 {
+ debug a => _65; // in scope 43 at $DIR/reference_prop.rs:+85:13: +85:14
+ let _66: *const usize; // in scope 43 at $DIR/reference_prop.rs:+86:13: +86:14
+ scope 44 {
+- debug b => _66; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:14
++ debug b => &_65; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:14
+ let _67: &*const usize; // in scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
+ scope 45 {
+- debug d => _67; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
++ debug d => &&_65; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
+ let _68: usize; // in scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
+ scope 46 {
+ debug c => _68; // in scope 46 at $DIR/reference_prop.rs:+88:13: +88:14
+ }
+ }
+ }
+ }
+ }
+ scope 47 {
+ let _71: usize; // in scope 47 at $DIR/reference_prop.rs:+94:13: +94:14
+ scope 48 {
+ debug a => _71; // in scope 48 at $DIR/reference_prop.rs:+94:13: +94:14
+ let mut _72: *const usize; // in scope 48 at $DIR/reference_prop.rs:+95:13: +95:18
+ scope 49 {
+- debug b => _72; // in scope 49 at $DIR/reference_prop.rs:+95:13: +95:18
++ debug b => &_71; // in scope 49 at $DIR/reference_prop.rs:+95:13: +95:18
+ let _73: &mut *const usize; // in scope 49 at $DIR/reference_prop.rs:+96:13: +96:14
+ scope 50 {
+- debug d => _73; // in scope 50 at $DIR/reference_prop.rs:+96:13: +96:14
++ debug d => &&_71; // in scope 50 at $DIR/reference_prop.rs:+96:13: +96:14
+ let _74: usize; // in scope 50 at $DIR/reference_prop.rs:+97:13: +97:14
+ scope 51 {
+ debug c => _74; // in scope 51 at $DIR/reference_prop.rs:+97:13: +97:14
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:14
+ _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:17: +3:24
+- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+- _5 = &raw const _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29
+ StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
++ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
+ StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
+ StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
+ _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
+ _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:202:9: 202:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19
+ StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20
+- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+ StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:14
+ _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:17: +11:24
+ StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:15
+ _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:18: +12:25
+ StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
+ _12 = &raw const _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:33
+ StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26
+ _13 = &raw const _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26
+ _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:26
+ StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:25: +14:26
+ StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
+ _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19
+ StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
+ StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
+ _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
+ _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:213:9: 213:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19
+ StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20
+- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:14
+ _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:17: +22:24
+ StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
+ _19 = &raw const _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:29
+ StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
+ _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19
+ StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
+ _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19
+ StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
+ StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+ _23 = _20; // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+ _22 = opaque::<&*const usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:222:9: 222:15
+ // + literal: Const { ty: fn(&*const usize) {opaque::<&*const usize>}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18
+ StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
+- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:14
+ _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:17: +31:24
+ StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
+ _26 = &raw const _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:33
+ StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+ _27 = &raw mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27
+ StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
+ _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19
+ StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
+ StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+ _30 = _27; // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+ _29 = opaque::<*mut *const usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:231:9: 231:15
+ // + literal: Const { ty: fn(*mut *const usize) {opaque::<*mut *const usize>}, val: Value(<ZST>) }
+ }
+
+ bb4: {
+ StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18
+ StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
+- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:14
+ _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:17: +40:24
+ StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
+ _33 = &raw const _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:29
+ StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
+- _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19
++ _34 = _32; // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19
+ StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
+ StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
+ _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
+ _35 = opaque::<*const usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:239:9: 239:15
+ // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value(<ZST>) }
+ }
+
+ bb5: {
+ StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18
+ StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19
+- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:14
+ _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:17: +48:24
+ StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
+ _39 = &raw const _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:30
+ StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
+- _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20
++ _40 = _38; // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20
+ StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
+ _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20
+ StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
+- _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21
++ _42 = _38; // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21
+ StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
+ _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20
+ StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
+ StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
+ _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
+ _44 = opaque::<*const usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:252:9: 252:15
+ // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value(<ZST>) }
+ }
+
+ bb6: {
+ StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19
+ StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20
+- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+- StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+- _47 = &raw const (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:35
+ StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
+- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
++ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
+ StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
+ StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
+ _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
+ _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:259:9: 259:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb7: {
+ StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19
+ StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20
+- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6
+ StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
+ _52 = &raw const (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:37
+ StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38
+ _53 = &raw const (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38
+ _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:38
+ StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:37: +69:38
+ StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
+ _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19
+ StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
+ StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
+ _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
+ _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:267:9: 267:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb8: {
+ StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19
+ StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20
+- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6
+ StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageLive(_57); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageLive(_58); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:14
+ _58 = const 13_usize; // scope 37 at $DIR/reference_prop.rs:+76:17: +76:25
+- StorageLive(_59); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+- _59 = &raw const _58; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:29
+- StorageLive(_60); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+- _60 = &raw const (*_59); // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30
+ StorageLive(_61); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
+- _61 = (*_60); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
++ _61 = _58; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
+ StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
+ StorageLive(_63); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
+ _63 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
+ _62 = opaque::<()>(move _63) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:276:9: 276:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb9: {
+ StorageDead(_63); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19
+ StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20
+- _57 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageDead(_61); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_60); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_59); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageDead(_58); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_57); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageLive(_64); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
+ StorageLive(_65); // scope 42 at $DIR/reference_prop.rs:+85:13: +85:14
+ _65 = const 5_usize; // scope 42 at $DIR/reference_prop.rs:+85:17: +85:24
+- StorageLive(_66); // scope 43 at $DIR/reference_prop.rs:+86:13: +86:14
+- _66 = &raw const _65; // scope 43 at $DIR/reference_prop.rs:+86:17: +86:29
+- StorageLive(_67); // scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
+- _67 = &_66; // scope 44 at $DIR/reference_prop.rs:+87:17: +87:19
+ StorageLive(_68); // scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
+- _68 = (*_66); // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
++ _68 = _65; // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
+ StorageLive(_69); // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
+ StorageLive(_70); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
+ _70 = (); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
+ _69 = opaque::<()>(move _70) -> bb10; // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:285:9: 285:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb10: {
+ StorageDead(_70); // scope 46 at $DIR/reference_prop.rs:+89:18: +89:19
+ StorageDead(_69); // scope 46 at $DIR/reference_prop.rs:+89:19: +89:20
+- _64 = const (); // scope 42 at $DIR/reference_prop.rs:+84:5: +90:6
+ StorageDead(_68); // scope 45 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_67); // scope 44 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_66); // scope 43 at $DIR/reference_prop.rs:+90:5: +90:6
+ StorageDead(_65); // scope 42 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_64); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6
+ StorageLive(_71); // scope 47 at $DIR/reference_prop.rs:+94:13: +94:14
+ _71 = const 5_usize; // scope 47 at $DIR/reference_prop.rs:+94:17: +94:24
+- StorageLive(_72); // scope 48 at $DIR/reference_prop.rs:+95:13: +95:18
+- _72 = &raw const _71; // scope 48 at $DIR/reference_prop.rs:+95:21: +95:33
+- StorageLive(_73); // scope 49 at $DIR/reference_prop.rs:+96:13: +96:14
+- _73 = &mut _72; // scope 49 at $DIR/reference_prop.rs:+96:17: +96:23
+ StorageLive(_74); // scope 50 at $DIR/reference_prop.rs:+97:13: +97:14
+- _74 = (*_72); // scope 50 at $DIR/reference_prop.rs:+97:17: +97:19
++ _74 = _71; // scope 50 at $DIR/reference_prop.rs:+97:17: +97:19
+ StorageLive(_75); // scope 51 at $DIR/reference_prop.rs:+98:9: +98:19
+ StorageLive(_76); // scope 51 at $DIR/reference_prop.rs:+98:16: +98:18
+ _76 = (); // scope 51 at $DIR/reference_prop.rs:+98:16: +98:18
+ _75 = opaque::<()>(move _76) -> bb11; // scope 51 at $DIR/reference_prop.rs:+98:9: +98:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:294:9: 294:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb11: {
+ StorageDead(_76); // scope 51 at $DIR/reference_prop.rs:+98:18: +98:19
+ StorageDead(_75); // scope 51 at $DIR/reference_prop.rs:+98:19: +98:20
+ _0 = const (); // scope 47 at $DIR/reference_prop.rs:+93:5: +99:6
+ StorageDead(_74); // scope 50 at $DIR/reference_prop.rs:+99:5: +99:6
+- StorageDead(_73); // scope 49 at $DIR/reference_prop.rs:+99:5: +99:6
+- StorageDead(_72); // scope 48 at $DIR/reference_prop.rs:+99:5: +99:6
+ StorageDead(_71); // scope 47 at $DIR/reference_prop.rs:+99:5: +99:6
+ return; // scope 0 at $DIR/reference_prop.rs:+100:2: +100:2
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
new file mode 100644
index 000000000..8d059de5b
--- /dev/null
+++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff
@@ -0,0 +1,472 @@
+- // MIR for `reference_propagation_mut` before ReferencePropagation
++ // MIR for `reference_propagation_mut` after ReferencePropagation
+
+ fn reference_propagation_mut(_1: &mut T, _2: &mut T) -> () {
+ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49
+ debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:62: +0:74
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87
+ let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ let mut _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:18
+ let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
+ let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
+ let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ let mut _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:18
+ let mut _13: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20
+ let mut _14: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20
+ let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
+ let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
+ let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ let mut _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:18
+ let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+ let mut _24: &&mut usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
+ let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ let mut _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:18
+ let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+ let mut _31: *mut &mut usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
+ let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ let mut _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:18
+ let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
+ let mut _37: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
+ let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ let mut _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:18
+ let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
+ let mut _46: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
+ let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+ let _48: &mut T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
+ let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
+ let _52: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ let _53: &mut T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
+ let mut _54: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32
+ let mut _55: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32
+ let _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
+ let mut _58: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
+ let _59: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ let mut _60: usize; // in scope 0 at $DIR/reference_prop.rs:+76:13: +76:18
+ let _64: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
+ let mut _65: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
+ let mut _66: usize; // in scope 0 at $DIR/reference_prop.rs:+85:13: +85:18
+ let _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
+ let mut _71: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ scope 1 {
+ debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
+ let _5: &mut usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+ scope 2 {
+- debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
++ debug b => &_4; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+ let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
+ scope 3 {
+ debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ }
+ }
+ }
+ scope 4 {
+ debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:18
+ let mut _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:19
+ scope 5 {
+ debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:19
+ let mut _12: &mut usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
+ scope 6 {
+ debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18
+ let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
+ scope 7 {
+ debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14
+ }
+ }
+ }
+ }
+ scope 8 {
+ debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:18
+ let _20: &mut usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
+ scope 9 {
+ debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14
+ let _21: &&mut usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
+ scope 10 {
+ debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14
+ let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
+ scope 11 {
+ debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14
+ }
+ }
+ }
+ }
+ scope 12 {
+ debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:18
+ let mut _27: &mut usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
+ scope 13 {
+ debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18
+ let _28: *mut &mut usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+ scope 14 {
+ debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14
+ let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
+ scope 15 {
+ debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14
+ }
+ }
+ }
+ }
+ scope 16 {
+ debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:18
+ let _34: &mut usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
+ scope 17 {
+ debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14
+ let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
+ scope 18 {
+ debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14
+ }
+ }
+ }
+ scope 19 {
+ debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:18
+ let _40: &mut usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
+ scope 20 {
+ debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15
+ let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
+ scope 21 {
+ debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14
+ let _42: &mut usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
+ scope 22 {
+ debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15
+ let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
+ scope 23 {
+ debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15
+ let _44: &mut usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
+ scope 24 {
+ debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 25 {
+- debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
++ debug a => _1; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
+ scope 26 {
+ debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14
+ }
+ }
+ scope 27 {
+ debug a => _53; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14
+ let _56: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
+ scope 28 {
+ debug b => _56; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14
+ }
+ }
+ scope 29 {
+ debug a => _60; // in scope 29 at $DIR/reference_prop.rs:+76:13: +76:18
+ let _61: &mut usize; // in scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
+ scope 30 {
+- debug b => _61; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
++ debug b => &_60; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14
+ let _62: &&mut usize; // in scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
+ scope 31 {
+- debug d => _62; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
++ debug d => &&_60; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14
+ let _63: usize; // in scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
+ scope 32 {
+ debug c => _63; // in scope 32 at $DIR/reference_prop.rs:+79:13: +79:14
+ }
+ }
+ }
+ }
+ scope 33 {
+ debug a => _66; // in scope 33 at $DIR/reference_prop.rs:+85:13: +85:18
+ let mut _67: &mut usize; // in scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
+ scope 34 {
+- debug b => _67; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
++ debug b => &_66; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18
+ let _68: &mut &mut usize; // in scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
+ scope 35 {
+- debug d => _68; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
++ debug d => &&_66; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14
+ let _69: usize; // in scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
+ scope 36 {
+ debug c => _69; // in scope 36 at $DIR/reference_prop.rs:+88:13: +88:14
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:18
+ _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:21: +3:28
+- StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14
+- _5 = &mut _4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23
+ StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14
+- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
++ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19
+ StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
+ StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
+ _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18
+ _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:109:9: 109:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19
+ StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20
+- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
+ StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:18
+ _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:21: +11:28
+ StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:19
+ _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:22: +12:29
+ StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18
+ _12 = &mut _10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:27
+ StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
+- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
+- _14 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
+- _13 = &mut (*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
++ _13 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20
+ _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:20
+ StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:19: +14:20
+- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:20: +14:21
+ StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14
+ _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19
+ StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
+ StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
+ _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18
+ _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:120:9: 120:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19
+ StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20
+- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:18
+ _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:21: +22:28
+ StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14
+ _20 = &mut _19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:23
+ StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14
+ _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19
+ StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14
+ _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19
+ StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
+ StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+ _24 = _21; // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17
+ _23 = opaque::<&&mut usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:129:9: 129:15
+ // + literal: Const { ty: fn(&&mut usize) {opaque::<&&mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18
+ StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19
+- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:18
+ _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:21: +31:28
+ StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18
+ _27 = &mut _26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:27
+ StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14
+ _28 = &raw mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27
+ StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14
+ _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19
+ StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
+ StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+ _31 = _28; // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17
+ _30 = opaque::<*mut &mut usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:138:9: 138:15
+ // + literal: Const { ty: fn(*mut &mut usize) {opaque::<*mut &mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb4: {
+ StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18
+ StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19
+- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:18
+ _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:21: +40:28
+ StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14
+ _34 = &mut _33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:23
+ StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14
+ _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19
+ StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
+ StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
+ _37 = move _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17
+ _36 = opaque::<&mut usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:146:9: 146:15
+ // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb5: {
+ StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18
+ StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19
+- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:18
+ _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:21: +48:28
+ StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15
+ _40 = &mut _39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:24
+ StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14
+ _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20
+ StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15
+ _42 = move _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20
+ StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15
+ _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21
+ StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15
+ _44 = move _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20
+ StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
+ StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
+ _46 = move _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18
+ _45 = opaque::<&mut usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:159:9: 159:15
+ // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb6: {
+ StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19
+ StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20
+- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+- StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14
+- _48 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:29
+ StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14
+- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
++ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19
+ StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
+ StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
+ _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18
+ _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:166:9: 166:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb7: {
+ StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19
+ StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20
+- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+ StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageLive(_53); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14
+ _53 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:31
+ StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
+- StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
+- _55 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
+- _54 = &mut (*_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
++ _54 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32
+ _2 = move _54; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:32
+ StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:31: +69:32
+- StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+69:32: +69:33
+ StorageLive(_56); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14
+ _56 = (*_53); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19
+ StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
+ StorageLive(_58); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
+ _58 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18
+ _57 = opaque::<()>(move _58) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:174:9: 174:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb8: {
+ StorageDead(_58); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19
+ StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20
+- _52 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageDead(_56); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6
+ StorageDead(_53); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageLive(_59); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageLive(_60); // scope 0 at $DIR/reference_prop.rs:+76:13: +76:18
+ _60 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+76:21: +76:28
+- StorageLive(_61); // scope 29 at $DIR/reference_prop.rs:+77:13: +77:14
+- _61 = &mut _60; // scope 29 at $DIR/reference_prop.rs:+77:17: +77:23
+- StorageLive(_62); // scope 30 at $DIR/reference_prop.rs:+78:13: +78:14
+- _62 = &_61; // scope 30 at $DIR/reference_prop.rs:+78:17: +78:19
+ StorageLive(_63); // scope 31 at $DIR/reference_prop.rs:+79:13: +79:14
+- _63 = (*_61); // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
++ _63 = _60; // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19
+ StorageLive(_64); // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
+ StorageLive(_65); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
+ _65 = (); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18
+ _64 = opaque::<()>(move _65) -> bb9; // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:183:9: 183:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb9: {
+ StorageDead(_65); // scope 32 at $DIR/reference_prop.rs:+80:18: +80:19
+ StorageDead(_64); // scope 32 at $DIR/reference_prop.rs:+80:19: +80:20
+- _59 = const (); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageDead(_63); // scope 31 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_62); // scope 30 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_61); // scope 29 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageDead(_60); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_59); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageLive(_66); // scope 0 at $DIR/reference_prop.rs:+85:13: +85:18
+ _66 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+85:21: +85:28
+- StorageLive(_67); // scope 33 at $DIR/reference_prop.rs:+86:13: +86:18
+- _67 = &mut _66; // scope 33 at $DIR/reference_prop.rs:+86:21: +86:27
+- StorageLive(_68); // scope 34 at $DIR/reference_prop.rs:+87:13: +87:14
+- _68 = &mut _67; // scope 34 at $DIR/reference_prop.rs:+87:17: +87:23
+ StorageLive(_69); // scope 35 at $DIR/reference_prop.rs:+88:13: +88:14
+- _69 = (*_67); // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
++ _69 = _66; // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19
+ StorageLive(_70); // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
+ StorageLive(_71); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
+ _71 = (); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18
+ _70 = opaque::<()>(move _71) -> bb10; // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:192:9: 192:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb10: {
+ StorageDead(_71); // scope 36 at $DIR/reference_prop.rs:+89:18: +89:19
+ StorageDead(_70); // scope 36 at $DIR/reference_prop.rs:+89:19: +89:20
+ _0 = const (); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6
+ StorageDead(_69); // scope 35 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_68); // scope 34 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_67); // scope 33 at $DIR/reference_prop.rs:+90:5: +90:6
+ StorageDead(_66); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6
+ return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
new file mode 100644
index 000000000..c93aa52be
--- /dev/null
+++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
@@ -0,0 +1,482 @@
+- // MIR for `reference_propagation_mut_ptr` before ReferencePropagation
++ // MIR for `reference_propagation_mut_ptr` after ReferencePropagation
+
+ fn reference_propagation_mut_ptr(_1: *mut T, _2: *mut T) -> () {
+ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49
+ debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:59: +0:71
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:81: +0:81
+ let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19
+ let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18
+ let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ let mut _13: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:24
+ let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19
+ let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18
+ let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18
+ let mut _23: &*mut usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17
+ let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18
+ let mut _30: *mut *mut usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17
+ let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18
+ let mut _36: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17
+ let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19
+ let mut _45: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18
+ let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+ let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19
+ let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18
+ let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ let mut _53: *mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:36
+ let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19
+ let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18
+ let _57: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ let _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19
+ let mut _63: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18
+ let _68: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19
+ let mut _69: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18
+ scope 1 {
+ let mut _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
+ scope 2 {
+ debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:18
+ let _5: *mut usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+ scope 3 {
+- debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
++ debug b => &_4; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14
+ let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+ scope 4 {
+ debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14
+ }
+ }
+ }
+ }
+ scope 5 {
+ let mut _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:18
+ scope 6 {
+ debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:18
+ let mut _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:19
+ scope 7 {
+ debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:19
+ let mut _12: *mut usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
+ scope 8 {
+ debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18
+ let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
+ scope 9 {
+ debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14
+ }
+ }
+ }
+ }
+ }
+ scope 10 {
+ let mut _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:18
+ scope 11 {
+ debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:18
+ let _19: *mut usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
+ scope 12 {
+ debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14
+ let _20: &*mut usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
+ scope 13 {
+ debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14
+ let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
+ scope 14 {
+ debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14
+ }
+ }
+ }
+ }
+ }
+ scope 15 {
+ let mut _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:18
+ scope 16 {
+ debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:18
+ let mut _26: *mut usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
+ scope 17 {
+ debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18
+ let _27: *mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+ scope 18 {
+ debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14
+ let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
+ scope 19 {
+ debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14
+ }
+ }
+ }
+ }
+ }
+ scope 20 {
+ let mut _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:18
+ scope 21 {
+ debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:18
+ let _33: *mut usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
+ scope 22 {
+ debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14
+ let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
+ scope 23 {
+ debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14
+ }
+ }
+ }
+ }
+ scope 24 {
+ let mut _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:18
+ scope 25 {
+ debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:18
+ let _39: *mut usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
+ scope 26 {
+ debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15
+ let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
+ scope 27 {
+ debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14
+ let _41: *mut usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
+ scope 28 {
+ debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15
+ let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
+ scope 29 {
+ debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15
+ let _43: *mut usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
+ scope 30 {
+ debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ scope 31 {
+ let _47: *mut T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+ scope 32 {
+- debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
++ debug a => _1; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14
+ let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
+ scope 33 {
+ debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14
+ }
+ }
+ }
+ scope 34 {
+ let _52: *mut T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
+ scope 35 {
+ debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14
+ let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
+ scope 36 {
+ debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14
+ }
+ }
+ }
+ scope 37 {
+ let mut _58: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:18
+ scope 38 {
+ debug a => _58; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:18
+ let _59: *mut usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+ scope 39 {
+- debug b => _59; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
++ debug b => &_58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14
+ let _60: &*mut usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+ scope 40 {
+- debug d => _60; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
++ debug d => &&_58; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14
+ let _61: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
+ scope 41 {
+ debug c => _61; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14
+ }
+ }
+ }
+ }
+ }
+ scope 42 {
+ let mut _64: usize; // in scope 42 at $DIR/reference_prop.rs:+85:13: +85:18
+ scope 43 {
+ debug a => _64; // in scope 43 at $DIR/reference_prop.rs:+85:13: +85:18
+ let mut _65: *mut usize; // in scope 43 at $DIR/reference_prop.rs:+86:13: +86:18
+ scope 44 {
+- debug b => _65; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:18
++ debug b => &_64; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:18
+ let _66: &mut *mut usize; // in scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
+ scope 45 {
+- debug d => _66; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
++ debug d => &&_64; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14
+ let _67: usize; // in scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
+ scope 46 {
+ debug c => _67; // in scope 46 at $DIR/reference_prop.rs:+88:13: +88:14
+ }
+ }
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:18
+ _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:21: +3:28
+- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14
+- _5 = &raw mut _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27
+ StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14
+- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
++ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19
+ StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
+ StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
+ _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18
+ _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:304:9: 304:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19
+ StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20
+- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6
+ StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+ StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:18
+ _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:21: +11:28
+ StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:19
+ _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:22: +12:29
+ StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18
+ _12 = &raw mut _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:31
+ StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24
+ _13 = &raw mut _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24
+ _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:24
+ StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:23: +14:24
+ StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14
+ _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19
+ StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
+ StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
+ _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18
+ _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:315:9: 315:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19
+ StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20
+- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6
+ StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6
+ StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6
+- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:18
+ _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:21: +22:28
+ StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14
+ _19 = &raw mut _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:27
+ StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14
+ _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19
+ StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14
+ _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19
+ StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
+ StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+ _23 = _20; // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17
+ _22 = opaque::<&*mut usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:324:9: 324:15
+ // + literal: Const { ty: fn(&*mut usize) {opaque::<&*mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18
+ StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19
+- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6
+ StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6
+ StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6
+- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:18
+ _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:21: +31:28
+ StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18
+ _26 = &raw mut _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:31
+ StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14
+ _27 = &raw mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27
+ StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14
+ _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19
+ StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
+ StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+ _30 = _27; // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17
+ _29 = opaque::<*mut *mut usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:333:9: 333:15
+ // + literal: Const { ty: fn(*mut *mut usize) {opaque::<*mut *mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb4: {
+ StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18
+ StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19
+- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6
+ StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6
+ StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6
+- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:18
+ _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:21: +40:28
+ StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14
+ _33 = &raw mut _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:27
+ StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14
+ _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19
+ StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
+ StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
+ _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17
+ _35 = opaque::<*mut usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:341:9: 341:15
+ // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb5: {
+ StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18
+ StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19
+- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6
+ StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6
+ StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6
+- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:18
+ _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:21: +48:28
+ StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15
+ _39 = &raw mut _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:28
+ StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14
+ _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20
+ StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15
+ _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20
+ StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15
+ _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21
+ StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15
+ _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20
+ StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
+ StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
+ _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18
+ _44 = opaque::<*mut usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:354:9: 354:15
+ // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value(<ZST>) }
+ }
+
+ bb6: {
+ StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19
+ StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20
+- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6
+ StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6
+ StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6
+- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6
+- StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14
+- _47 = &raw mut (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:33
+ StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14
+- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
++ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19
+ StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
+ StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
+ _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18
+ _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:361:9: 361:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb7: {
+ StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19
+ StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20
+- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6
+ StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6
+- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14
+ _52 = &raw mut (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:35
+ StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36
+ _53 = &raw mut (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36
+ _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:36
+ StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:35: +69:36
+ StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14
+ _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19
+ StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
+ StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
+ _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18
+ _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:369:9: 369:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb8: {
+ StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19
+ StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20
+- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6
+ StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6
+ StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6
+- StorageLive(_57); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageLive(_58); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:18
+ _58 = const 5_usize; // scope 37 at $DIR/reference_prop.rs:+76:21: +76:28
+- StorageLive(_59); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14
+- _59 = &raw mut _58; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:27
+- StorageLive(_60); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14
+- _60 = &_59; // scope 39 at $DIR/reference_prop.rs:+78:17: +78:19
+ StorageLive(_61); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14
+- _61 = (*_59); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
++ _61 = _58; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19
+ StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
+ StorageLive(_63); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
+ _63 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18
+ _62 = opaque::<()>(move _63) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:378:9: 378:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb9: {
+ StorageDead(_63); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19
+ StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20
+- _57 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6
+ StorageDead(_61); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_60); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_59); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageDead(_58); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6
+- StorageDead(_57); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6
+ StorageLive(_64); // scope 42 at $DIR/reference_prop.rs:+85:13: +85:18
+ _64 = const 5_usize; // scope 42 at $DIR/reference_prop.rs:+85:21: +85:28
+- StorageLive(_65); // scope 43 at $DIR/reference_prop.rs:+86:13: +86:18
+- _65 = &raw mut _64; // scope 43 at $DIR/reference_prop.rs:+86:21: +86:31
+- StorageLive(_66); // scope 44 at $DIR/reference_prop.rs:+87:13: +87:14
+- _66 = &mut _65; // scope 44 at $DIR/reference_prop.rs:+87:17: +87:23
+ StorageLive(_67); // scope 45 at $DIR/reference_prop.rs:+88:13: +88:14
+- _67 = (*_65); // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
++ _67 = _64; // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19
+ StorageLive(_68); // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
+ StorageLive(_69); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
+ _69 = (); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18
+ _68 = opaque::<()>(move _69) -> bb10; // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:387:9: 387:15
+ // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value(<ZST>) }
+ }
+
+ bb10: {
+ StorageDead(_69); // scope 46 at $DIR/reference_prop.rs:+89:18: +89:19
+ StorageDead(_68); // scope 46 at $DIR/reference_prop.rs:+89:19: +89:20
+ _0 = const (); // scope 42 at $DIR/reference_prop.rs:+84:5: +90:6
+ StorageDead(_67); // scope 45 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_66); // scope 44 at $DIR/reference_prop.rs:+90:5: +90:6
+- StorageDead(_65); // scope 43 at $DIR/reference_prop.rs:+90:5: +90:6
+ StorageDead(_64); // scope 42 at $DIR/reference_prop.rs:+90:5: +90:6
+ return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2
+ }
+ }
+
diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs
new file mode 100644
index 000000000..4083b4547
--- /dev/null
+++ b/tests/mir-opt/reference_prop.rs
@@ -0,0 +1,592 @@
+// unit-test: ReferencePropagation
+// needs-unwind
+
+#![feature(raw_ref_op)]
+#![feature(core_intrinsics, custom_mir)]
+
+#[inline(never)]
+fn opaque(_: impl Sized) {}
+
+fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) {
+ // Propagation through a reference.
+ {
+ 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.
+ {
+ let a = 5_usize;
+ let a2 = 7_usize;
+ let mut b = &a;
+ b = &a2;
+ // `b` is assigned twice, so we cannot propagate it.
+ let c = *b;
+ opaque(());
+ }
+
+ // Propagation through a borrowed reference.
+ {
+ let a = 5_usize;
+ let b = &a;
+ let d = &b;
+ let c = *b; // `b` is immutably borrowed, we know its value, but do not propagate it
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through a borrowed reference.
+ {
+ let a = 5_usize;
+ let mut b = &a;
+ let d = &raw mut b;
+ let c = *b; // `b` is mutably borrowed, we cannot know its value.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through an escaping borrow.
+ {
+ let a = 7_usize;
+ let b = &a;
+ let c = *b;
+ opaque(b); // `b` escapes here, but we can still replace immutable borrow
+ }
+
+ // Propagation through a transitively escaping borrow.
+ {
+ let a = 7_usize;
+ let b1 = &a;
+ let c = *b1;
+ let b2 = b1;
+ let c2 = *b2;
+ let b3 = b2;
+ // `b3` escapes here, so we can only replace immutable borrow,
+ // for either `b`, `b2` or `b3`.
+ opaque(b3);
+ }
+
+ // Propagation a reborrow of an argument.
+ {
+ let a = &*single;
+ let b = *a; // This should be optimized as `*single`.
+ opaque(());
+ }
+
+ // Propagation a reborrow of a mutated argument.
+ {
+ let a = &*multiple;
+ multiple = &*single;
+ let b = *a; // This should not be optimized.
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ {
+ let a = 5_usize;
+ let b = &a;
+ let d = &b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ {
+ let a = 5_usize;
+ let mut b = &a;
+ let d = &mut b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+}
+
+fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) {
+ // Propagation through a reference.
+ {
+ 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.
+ {
+ let mut a = 5_usize;
+ let mut a2 = 7_usize;
+ let mut b = &mut a;
+ b = &mut a2;
+ // `b` is assigned twice, so we cannot propagate it.
+ let c = *b;
+ opaque(());
+ }
+
+ // Propagation through a borrowed reference.
+ {
+ let mut a = 5_usize;
+ let b = &mut a;
+ let d = &b;
+ let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through a borrowed reference.
+ {
+ let mut a = 5_usize;
+ let mut b = &mut a;
+ let d = &raw mut b;
+ let c = *b; // `b` is mutably borrowed, we cannot know its value.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through an escaping borrow.
+ {
+ let mut a = 7_usize;
+ let b = &mut a;
+ let c = *b;
+ opaque(b); // `b` escapes here, so we can only replace immutable borrow
+ }
+
+ // Propagation through a transitively escaping borrow.
+ {
+ let mut a = 7_usize;
+ let b1 = &mut a;
+ let c = *b1;
+ let b2 = b1;
+ let c2 = *b2;
+ let b3 = b2;
+ // `b3` escapes here, so we can only replace immutable borrow,
+ // for either `b`, `b2` or `b3`.
+ opaque(b3);
+ }
+
+ // Propagation a reborrow of an argument.
+ {
+ let a = &mut *single;
+ let b = *a; // This should be optimized as `*single`.
+ opaque(());
+ }
+
+ // Propagation a reborrow of a mutated argument.
+ {
+ let a = &mut *multiple;
+ multiple = &mut *single;
+ let b = *a; // This should not be optimized.
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ {
+ let mut a = 5_usize;
+ let b = &mut a;
+ let d = &b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ {
+ let mut a = 5_usize;
+ let mut b = &mut a;
+ let d = &mut b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+}
+
+fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *const T) {
+ // Propagation through a reference.
+ unsafe {
+ 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.
+ unsafe {
+ let a = 5_usize;
+ let a2 = 7_usize;
+ let mut b = &raw const a;
+ b = &raw const a2;
+ // `b` is assigned twice, so we cannot propagate it.
+ let c = *b;
+ opaque(());
+ }
+
+ // Propagation through a borrowed reference.
+ unsafe {
+ let a = 5_usize;
+ let b = &raw const a;
+ let d = &b;
+ let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through a borrowed reference.
+ unsafe {
+ let a = 5_usize;
+ let mut b = &raw const a;
+ let d = &raw mut b;
+ let c = *b; // `b` is mutably borrowed, we cannot know its value.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through an escaping borrow.
+ unsafe {
+ let a = 7_usize;
+ let b = &raw const a;
+ let c = *b;
+ opaque(b); // `b` escapes here, so we can only replace immutable borrow
+ }
+
+ // Propagation through a transitively escaping borrow.
+ unsafe {
+ let a = 7_usize;
+ let b1 = &raw const a;
+ let c = *b1;
+ let b2 = b1;
+ let c2 = *b2;
+ let b3 = b2;
+ // `b3` escapes here, so we can only replace immutable borrow,
+ // for either `b`, `b2` or `b3`.
+ opaque(b3);
+ }
+
+ // Propagation a reborrow of an argument.
+ unsafe {
+ let a = &raw const *single;
+ let b = *a; // This should be optimized as `*single`.
+ opaque(());
+ }
+
+ // Propagation a reborrow of a mutated argument.
+ unsafe {
+ let a = &raw const *multiple;
+ multiple = &raw const *single;
+ let b = *a; // This should not be optimized.
+ opaque(());
+ }
+
+ // Propagation through a reborrow.
+ unsafe {
+ let a = 13_usize;
+ let b = &raw const a;
+ let c = &raw const *b;
+ let e = *c;
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ unsafe {
+ let a = 5_usize;
+ let b = &raw const a;
+ let d = &b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ unsafe {
+ let a = 5_usize;
+ let mut b = &raw const a;
+ let d = &mut b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+}
+
+fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) {
+ // Propagation through a reference.
+ unsafe {
+ 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.
+ unsafe {
+ let mut a = 5_usize;
+ let mut a2 = 7_usize;
+ let mut b = &raw mut a;
+ b = &raw mut a2;
+ // `b` is assigned twice, so we cannot propagate it.
+ let c = *b;
+ opaque(());
+ }
+
+ // Propagation through a borrowed reference.
+ unsafe {
+ let mut a = 5_usize;
+ let b = &raw mut a;
+ let d = &b;
+ let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through a borrowed reference.
+ unsafe {
+ let mut a = 5_usize;
+ let mut b = &raw mut a;
+ let d = &raw mut b;
+ let c = *b; // `b` is mutably borrowed, we cannot know its value.
+ opaque(d); // prevent `d` from being removed.
+ }
+
+ // Propagation through an escaping borrow.
+ unsafe {
+ let mut a = 7_usize;
+ let b = &raw mut a;
+ let c = *b;
+ opaque(b); // `b` escapes here, so we can only replace immutable borrow
+ }
+
+ // Propagation through a transitively escaping borrow.
+ unsafe {
+ let mut a = 7_usize;
+ let b1 = &raw mut a;
+ let c = *b1;
+ let b2 = b1;
+ let c2 = *b2;
+ let b3 = b2;
+ // `b3` escapes here, so we can only replace immutable borrow,
+ // for either `b`, `b2` or `b3`.
+ opaque(b3);
+ }
+
+ // Propagation a reborrow of an argument.
+ unsafe {
+ let a = &raw mut *single;
+ let b = *a; // This should be optimized as `*single`.
+ opaque(());
+ }
+
+ // Propagation a reborrow of a mutated argument.
+ unsafe {
+ let a = &raw mut *multiple;
+ multiple = &raw mut *single;
+ let b = *a; // This should not be optimized.
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ unsafe {
+ let mut a = 5_usize;
+ let b = &raw mut a;
+ let d = &b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+
+ // Fixed-point propagation through a borrowed reference.
+ unsafe {
+ let mut a = 5_usize;
+ let mut b = &raw mut a;
+ let d = &mut b; // first round promotes debuginfo for `d`
+ let c = *b; // second round propagates this dereference
+ opaque(());
+ }
+}
+
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn read_through_raw(x: &mut usize) -> usize {
+ use std::intrinsics::mir::*;
+
+ mir!(
+ let r1: &mut usize;
+ let r2: &mut usize;
+ let p1: *mut usize;
+ let p2: *mut usize;
+
+ {
+ r1 = &mut *x;
+ r2 = &mut *r1;
+ p1 = &raw mut *r1;
+ p2 = &raw mut *r2;
+
+ RET = *p1;
+ RET = *p2;
+ Return()
+ }
+ )
+}
+
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn multiple_storage() {
+ use std::intrinsics::mir::*;
+
+ mir!(
+ let x: i32;
+ {
+ StorageLive(x);
+ x = 5;
+ let z = &x;
+ StorageDead(x);
+ StorageLive(x);
+ // As there are multiple `StorageLive` statements for `x`, we cannot know if this `z`'s
+ // pointer address is the address of `x`, so do nothing.
+ let y = *z;
+ Call(RET, retblock, opaque(y))
+ }
+
+ retblock = {
+ Return()
+ }
+ )
+}
+
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn dominate_storage() {
+ use std::intrinsics::mir::*;
+
+ mir!(
+ let x: i32;
+ let r: &i32;
+ let c: i32;
+ let d: bool;
+ { Goto(bb0) }
+ bb0 = {
+ x = 5;
+ r = &x;
+ Goto(bb1)
+ }
+ bb1 = {
+ let c = *r;
+ Call(RET, bb2, opaque(c))
+ }
+ bb2 = {
+ StorageDead(x);
+ StorageLive(x);
+ let d = true;
+ match d { false => bb2, _ => bb0 }
+ }
+ )
+}
+
+#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
+fn maybe_dead(m: bool) {
+ use std::intrinsics::mir::*;
+
+ mir!(
+ let x: i32;
+ let y: i32;
+ {
+ StorageLive(x);
+ StorageLive(y);
+ x = 5;
+ y = 5;
+ let a = &x;
+ let b = &mut y;
+ // As we don't replace `b` in `bb2`, we cannot replace it here either.
+ *b = 7;
+ // But this can still be replaced.
+ let u = *a;
+ match m { true => bb1, _ => bb2 }
+ }
+ bb1 = {
+ StorageDead(x);
+ StorageDead(y);
+ Call(RET, bb2, opaque(u))
+ }
+ bb2 = {
+ // As `x` may be `StorageDead`, `a` may be dangling, so we do nothing.
+ let z = *a;
+ Call(RET, bb3, opaque(z))
+ }
+ bb3 = {
+ // As `y` may be `StorageDead`, `b` may be dangling, so we do nothing.
+ // This implies that we also do not substitute `b` in `bb0`.
+ let t = *b;
+ Call(RET, retblock, opaque(t))
+ }
+ retblock = {
+ Return()
+ }
+ )
+}
+
+fn mut_raw_then_mut_shr() -> (i32, i32) {
+ let mut x = 2;
+ let xref = &mut x;
+ let xraw = &mut *xref as *mut _;
+ let xshr = &*xref;
+ // Verify that we completely replace with `x` in both cases.
+ let a = *xshr;
+ unsafe { *xraw = 4; }
+ (a, x)
+}
+
+fn unique_with_copies() {
+ let y = {
+ let mut a = 0;
+ let x = &raw mut a;
+ // `*y` is not replacable below, so we must not replace `*x`.
+ unsafe { opaque(*x) };
+ x
+ };
+ // But rewriting as `*x` is ok.
+ unsafe { opaque(*y) };
+}
+
+fn debuginfo() {
+ struct T(u8);
+
+ let ref_mut_u8 = &mut 5_u8;
+ let field = &T(0).0;
+
+ // Verify that we don't emit `&*` in debuginfo.
+ let reborrow = &*ref_mut_u8;
+
+ match Some(0) {
+ None => {}
+ Some(ref variant_field) => {}
+ }
+
+ // `constant_index_from_end` and `subslice` should not be promoted, as their value depends
+ // on the slice length.
+ if let [_, ref constant_index, subslice @ .., ref constant_index_from_end] = &[6; 10][..] {
+ }
+
+ let multiple_borrow = &&&mut T(6).0;
+}
+
+fn many_debuginfo() {
+ let a = 0;
+
+ // Verify that we do not ICE on deeply nested borrows.
+ let many_borrow =
+ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&a;
+}
+
+fn main() {
+ let mut x = 5_usize;
+ let mut y = 7_usize;
+ reference_propagation(&x, &y);
+ reference_propagation_mut(&mut x, &mut y);
+ reference_propagation_const_ptr(&raw const x, &raw const y);
+ reference_propagation_mut_ptr(&raw mut x, &raw mut y);
+ read_through_raw(&mut x);
+ multiple_storage();
+ dominate_storage();
+ maybe_dead(true);
+ mut_raw_then_mut_shr();
+ unique_with_copies();
+ debuginfo();
+ many_debuginfo();
+}
+
+// EMIT_MIR reference_prop.reference_propagation.ReferencePropagation.diff
+// EMIT_MIR reference_prop.reference_propagation_mut.ReferencePropagation.diff
+// EMIT_MIR reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff
+// EMIT_MIR reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff
+// EMIT_MIR reference_prop.read_through_raw.ReferencePropagation.diff
+// EMIT_MIR reference_prop.multiple_storage.ReferencePropagation.diff
+// EMIT_MIR reference_prop.dominate_storage.ReferencePropagation.diff
+// EMIT_MIR reference_prop.maybe_dead.ReferencePropagation.diff
+// EMIT_MIR reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff
+// EMIT_MIR reference_prop.unique_with_copies.ReferencePropagation.diff
+// EMIT_MIR reference_prop.debuginfo.ReferencePropagation.diff
diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
new file mode 100644
index 000000000..b754aff47
--- /dev/null
+++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff
@@ -0,0 +1,67 @@
+- // MIR for `unique_with_copies` before ReferencePropagation
++ // MIR for `unique_with_copies` after ReferencePropagation
+
+ fn unique_with_copies() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:25: +0:25
+ let _1: *mut i32; // in scope 0 at $DIR/reference_prop.rs:+1:9: +1:10
+ let mut _2: i32; // in scope 0 at $DIR/reference_prop.rs:+2:13: +2:18
+ let _4: (); // in scope 0 at $DIR/reference_prop.rs:+5:18: +5:28
+ let mut _5: i32; // in scope 0 at $DIR/reference_prop.rs:+5:25: +5:27
+ let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:14: +9:24
+ let mut _7: i32; // in scope 0 at $DIR/reference_prop.rs:+9:21: +9:23
+ scope 1 {
+- debug y => _1; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
++ debug y => _3; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10
+ scope 5 {
+ }
+ }
+ scope 2 {
+ debug a => _2; // in scope 2 at $DIR/reference_prop.rs:+2:13: +2:18
+ let _3: *mut i32; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
+ scope 3 {
+ debug x => _3; // in scope 3 at $DIR/reference_prop.rs:+3:13: +3:14
+ scope 4 {
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+1:9: +1:10
+ StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+2:13: +2:18
+ _2 = const 0_i32; // scope 0 at $DIR/reference_prop.rs:+2:21: +2:22
+- StorageLive(_3); // scope 2 at $DIR/reference_prop.rs:+3:13: +3:14
+ _3 = &raw mut _2; // scope 2 at $DIR/reference_prop.rs:+3:17: +3:27
+ StorageLive(_4); // scope 3 at $DIR/reference_prop.rs:+5:9: +5:30
+ StorageLive(_5); // scope 4 at $DIR/reference_prop.rs:+5:25: +5:27
+ _5 = (*_3); // scope 4 at $DIR/reference_prop.rs:+5:25: +5:27
+ _4 = opaque::<i32>(move _5) -> bb1; // scope 4 at $DIR/reference_prop.rs:+5:18: +5:28
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:524:18: 524:24
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageDead(_5); // scope 4 at $DIR/reference_prop.rs:+5:27: +5:28
+ StorageDead(_4); // scope 3 at $DIR/reference_prop.rs:+5:30: +5:31
+- _1 = _3; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:10
+- StorageDead(_3); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6
+ StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6
+ StorageLive(_6); // scope 1 at $DIR/reference_prop.rs:+9:5: +9:26
+ StorageLive(_7); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23
+- _7 = (*_1); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23
++ _7 = (*_3); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23
+ _6 = opaque::<i32>(move _7) -> bb2; // scope 5 at $DIR/reference_prop.rs:+9:14: +9:24
+ // mir::Constant
+ // + span: $DIR/reference_prop.rs:528:14: 528:20
+ // + literal: Const { ty: fn(i32) {opaque::<i32>}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ StorageDead(_7); // scope 5 at $DIR/reference_prop.rs:+9:23: +9:24
+ StorageDead(_6); // scope 1 at $DIR/reference_prop.rs:+9:26: +9:27
+ _0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:25: +10:2
+- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+10:1: +10:2
+ return; // scope 0 at $DIR/reference_prop.rs:+10:2: +10:2
+ }
+ }
+
diff --git a/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir b/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir
deleted file mode 100644
index cae89fb17..000000000
--- a/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir
+++ /dev/null
@@ -1,42 +0,0 @@
-// MIR for `ezmap` after PreCodegen
-
-fn ezmap(_1: Option<i32>) -> Option<i32> {
- debug x => _1; // in scope 0 at $DIR/simple_option_map_e2e.rs:+0:14: +0:15
- let mut _0: std::option::Option<i32>; // return place in scope 0 at $DIR/simple_option_map_e2e.rs:+0:33: +0:44
- scope 1 (inlined map::<i32, i32, [closure@$DIR/simple_option_map_e2e.rs:14:12: 14:15]>) { // at $DIR/simple_option_map_e2e.rs:14:5: 14:22
- debug slf => _1; // in scope 1 at $DIR/simple_option_map_e2e.rs:2:17: 2:20
- debug f => const ZeroSized: [closure@$DIR/simple_option_map_e2e.rs:14:12: 14:15]; // in scope 1 at $DIR/simple_option_map_e2e.rs:2:33: 2:34
- let mut _2: isize; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:9: 7:16
- let _3: i32; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:14: 7:15
- let mut _4: i32; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:25: 7:29
- scope 2 {
- debug x => _3; // in scope 2 at $DIR/simple_option_map_e2e.rs:7:14: 7:15
- scope 3 (inlined ezmap::{closure#0}) { // at $DIR/simple_option_map_e2e.rs:7:25: 7:29
- debug n => _3; // in scope 3 at $DIR/simple_option_map_e2e.rs:+1:13: +1:14
- }
- }
- }
-
- bb0: {
- _2 = discriminant(_1); // scope 1 at $DIR/simple_option_map_e2e.rs:6:11: 6:14
- switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map_e2e.rs:6:5: 6:14
- }
-
- bb1: {
- _0 = Option::<i32>::None; // scope 1 at $DIR/simple_option_map_e2e.rs:8:17: 8:21
- return; // scope 1 at $DIR/simple_option_map_e2e.rs:8:17: 8:21
- }
-
- bb2: {
- unreachable; // scope 1 at $DIR/simple_option_map_e2e.rs:6:11: 6:14
- }
-
- bb3: {
- _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map_e2e.rs:7:14: 7:15
- StorageLive(_4); // scope 2 at $DIR/simple_option_map_e2e.rs:7:25: 7:29
- _4 = Add(_3, const 1_i32); // scope 3 at $DIR/simple_option_map_e2e.rs:+1:16: +1:21
- _0 = Option::<i32>::Some(move _4); // scope 2 at $DIR/simple_option_map_e2e.rs:7:20: 7:30
- StorageDead(_4); // scope 2 at $DIR/simple_option_map_e2e.rs:7:29: 7:30
- return; // scope 1 at $DIR/simple_option_map_e2e.rs:10:1: 10:2
- }
-}
diff --git a/tests/mir-opt/simplify_arm.rs b/tests/mir-opt/simplify_arm.rs
index c247872e2..4c471ce04 100644
--- a/tests/mir-opt/simplify_arm.rs
+++ b/tests/mir-opt/simplify_arm.rs
@@ -6,8 +6,7 @@
// EMIT_MIR simplify_arm.id_try.SimplifyArmIdentity.diff
// EMIT_MIR simplify_arm.id_try.SimplifyBranchSame.diff
-// This pass is broken since deaggregation changed
-// ignore-test
+// ignore-test This pass is broken since deaggregation changed
fn id(o: Option<u8>) -> Option<u8> {
match o {
diff --git a/tests/mir-opt/simplify_arm_identity.rs b/tests/mir-opt/simplify_arm_identity.rs
index cf6ff57aa..e122cd50e 100644
--- a/tests/mir-opt/simplify_arm_identity.rs
+++ b/tests/mir-opt/simplify_arm_identity.rs
@@ -4,8 +4,7 @@
// compile-flags: -Zmir-opt-level=3
// EMIT_MIR_FOR_EACH_BIT_WIDTH
-// This pass is broken since deaggregation changed
-// ignore-test
+// ignore-test This pass is broken since deaggregation changed
enum Src {
Foo(u8),
diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs
index 97c18af31..be32f40f1 100644
--- a/tests/mir-opt/slice_filter.rs
+++ b/tests/mir-opt/slice_filter.rs
@@ -12,7 +12,9 @@ pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize {
input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count()
}
+// EMIT_MIR slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
// EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff
// EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
// EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff
+// EMIT_MIR slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
// EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
index 3bb0358ff..60e5056c7 100644
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
+++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff
@@ -101,16 +101,16 @@
}
bb0: {
-- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+ StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
_25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
_3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
-- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+ StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
_26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
_4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
-- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+ StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
_27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
_5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
-- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+ StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
_28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
_6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
@@ -184,10 +184,10 @@
bb3: {
StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
}
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
index 294c3272f..afdcf5781 100644
--- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
+++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff
@@ -3,118 +3,79 @@
fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
- let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
- let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
- let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41
- let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
- let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
- let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
- let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51
- let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
- let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
- let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
- let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
- let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61
- let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
- let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
- let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
- let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71
- let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
- let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
- let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _3: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
+ let mut _4: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
+ let mut _5: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
+ let mut _6: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
+ let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
+ let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
+ let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _10: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _11: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _12: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
scope 1 {
- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
+ debug a => &((*_9).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
+ debug b => &((*_10).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
+ debug c => &((*_11).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
+ debug d => &((*_12).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
- debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &&((*_9).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &&((*_11).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _31: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _32: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &((*_9).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &((*_11).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _13: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _14: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
- debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _33: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _34: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &&((*_11).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &&((*_9).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => _33; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _34; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _35: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _36: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &((*_11).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &((*_9).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _15: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _16: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
- debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _37: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _38: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &&((*_12).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &&((*_10).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => _37; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _38; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _39: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _40: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &((*_12).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &((*_10).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _17: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _18: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
- debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _41: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _42: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &&((*_10).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &&((*_12).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug self => _41; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- debug other => _42; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _43: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- let mut _44: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug self => &((*_10).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ debug other => &((*_12).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _19: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _20: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
}
}
}
bb0: {
- _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
- _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
- _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
- _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
-- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+ _10 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+ _11 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+ _12 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+- StorageLive(_3); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
- _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _31 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _32 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _8 = Le(move _31, move _32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
- switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ StorageLive(_4); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
+ StorageLive(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _13 = ((*_9).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _14 = ((*_11).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _4 = Le(move _13, move _14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ switchInt(move _4) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
}
bb1: {
@@ -123,113 +84,80 @@
}
bb2: {
-- StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+- StorageLive(_6); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
- StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
- _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- _33 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _34 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _35 = (*_33); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _36 = (*_34); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _17 = Le(move _35, move _36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
- switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
+ StorageLive(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _15 = ((*_11).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _16 = ((*_9).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _7 = Le(move _15, move _16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ switchInt(move _7) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
}
bb3: {
-- StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_6); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_3); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
}
bb4: {
-- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
}
bb5: {
-- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
+- StorageLive(_5); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
- _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- _37 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _38 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_39); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _39 = (*_37); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _40 = (*_38); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _12 = Le(move _39, move _40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_39); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
-- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ StorageLive(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _17 = ((*_12).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _18 = ((*_10).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _5 = Le(move _17, move _18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _3 = move _5; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
-- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
-+ switchInt(move _12) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
++ switchInt(move _5) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
}
bb6: {
-- _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+- _6 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ _0 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
}
bb7: {
-- StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
+- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
- StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
- _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
- StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- _41 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _42 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _43 = (*_41); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageLive(_44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- _44 = (*_42); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-- _21 = Le(move _43, move _44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
-+ _0 = Le(move _43, move _44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ StorageLive(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _19 = ((*_10).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _20 = ((*_12).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _8 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _0 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _6 = move _8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
}
bb8: {
-- StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
- StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
-- _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- _0 = move _6; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
}
diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
new file mode 100644
index 000000000..2534eeef4
--- /dev/null
+++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff
@@ -0,0 +1,267 @@
+- // MIR for `variant_a::{closure#0}` before ReferencePropagation
++ // MIR for `variant_a::{closure#0}` after ReferencePropagation
+
+ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool {
+ let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40
+ let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+ let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+ let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+ let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+ let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56
+ let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46
+ let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41
+ let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
+ let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46
+ let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56
+ let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51
+ let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
+ let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56
+ let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76
+ let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66
+ let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61
+ let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
+ let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66
+ let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76
+ let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71
+ let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38
+ let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ scope 1 {
+- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
+- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
+- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
+- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
++ debug a => &((*_25).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28
++ debug b => &((*_26).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31
++ debug c => &((*_27).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34
++ debug d => &((*_28).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37
+ scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:40: 8:46
+- debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &&((*_25).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &&((*_27).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &((*_25).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &((*_27).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ }
+ }
+ scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:60: 8:66
+- debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &&((*_27).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &&((*_25).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &((*_27).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &((*_25).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ }
+ }
+ scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:50: 8:56
+- debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &&((*_28).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &&((*_26).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &((*_28).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &((*_26).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ }
+ }
+ scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { // at $DIR/slice_filter.rs:8:70: 8:76
+- debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &&((*_26).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &&((*_28).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug self => &((*_26).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ debug other => &((*_28).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ }
+ }
+ }
+
+ bb0: {
+- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+ _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28
+- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+ _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31
+- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+ _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34
+- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+ _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37
+ StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46
+- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
+- _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41
+- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+- _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _33 = ((*_25).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _34 = ((*_27).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46
+ switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ }
+
+ bb1: {
+ _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ }
+
+ bb2: {
+ StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66
+- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
+- _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61
+- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+- _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+- _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _39 = ((*_27).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _40 = ((*_25).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66
+ switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ }
+
+ bb3: {
+ StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76
+ return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76
+ }
+
+ bb4: {
+ _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ }
+
+ bb5: {
+ StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56
+- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
+- _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51
+- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _45 = ((*_28).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _46 = ((*_26).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56
+ StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56
+ switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ }
+
+ bb6: {
+ _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ }
+
+ bb7: {
+ StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76
+- StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
+- _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71
+- StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _51 = ((*_26).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
++ _52 = ((*_28).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+ StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL
+- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+- StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76
+ }
+
+ bb8: {
+ StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76
+ _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76
+ }
+ }
+
diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
new file mode 100644
index 000000000..d1241c6b0
--- /dev/null
+++ b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff
@@ -0,0 +1,103 @@
+- // MIR for `variant_b::{closure#0}` before ReferencePropagation
++ // MIR for `variant_b::{closure#0}` after ReferencePropagation
+
+ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool {
+ let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42
+ let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
+ let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
+ let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
+ let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
+ let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58
+ let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48
+ let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43
+ let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48
+ let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58
+ let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53
+ let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58
+ let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78
+ let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68
+ let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63
+ let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68
+ let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78
+ let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73
+ let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78
+ let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+ let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+ let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+ let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40
+ scope 1 {
+ debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30
+ debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33
+ debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36
+ debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39
+ }
+
+ bb0: {
+ _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
+ _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30
+ _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
+ _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33
+ _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
+ _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36
+ _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
+ _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39
+ StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+ StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
+ _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48
+ switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+ }
+
+ bb1: {
+ _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+ goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+ }
+
+ bb2: {
+ StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+ StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
+ _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68
+ switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+ }
+
+ bb3: {
+ StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+ StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+ return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78
+ }
+
+ bb4: {
+ _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+ StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+ StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+ goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+ }
+
+ bb5: {
+ StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
+ _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58
+ _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58
+ StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+ StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58
+ switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+ }
+
+ bb6: {
+ _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+ goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+ }
+
+ bb7: {
+ StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
+ _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78
+ _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+ goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78
+ }
+
+ bb8: {
+ StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+ StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78
+ _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+ goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78
+ }
+ }
+
diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
index 579587a43..9bda5f575 100644
--- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
+++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff
@@ -15,14 +15,14 @@
let mut _13: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
let _14: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
let _15: [&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28
- let mut _16: &[core::fmt::ArgumentV1<'_>]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let mut _17: &[core::fmt::ArgumentV1<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let _18: &[core::fmt::ArgumentV1<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let _19: [core::fmt::ArgumentV1<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
- let mut _20: core::fmt::ArgumentV1<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
+ let mut _16: &[core::fmt::rt::Argument<'_>]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
+ let mut _17: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
+ let _18: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
+ let _19: [core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL
+ let mut _20: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
let mut _21: &std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
let _22: &std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23
- let mut _23: core::fmt::ArgumentV1<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
+ let mut _23: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
let mut _24: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
let _25: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27
let mut _27: bool; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2
@@ -113,11 +113,11 @@
StorageLive(_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
_22 = &_8; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
_21 = &(*_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
- _20 = core::fmt::ArgumentV1::<'_>::new_display::<Box<dyn std::fmt::Display>>(move _21) -> [return: bb3, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
+ _20 = core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>(move _21) -> [return: bb3, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23
// mir::Constant
// + span: $DIR/lifetimes.rs:27:20: 27:23
// + user_ty: UserType(4)
- // + literal: Const { ty: for<'b> fn(&'b Box<dyn std::fmt::Display>) -> core::fmt::ArgumentV1<'b> {core::fmt::ArgumentV1::<'_>::new_display::<Box<dyn std::fmt::Display>>}, val: Value(<ZST>) }
+ // + literal: Const { ty: for<'b> fn(&'b Box<dyn std::fmt::Display>) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>}, val: Value(<ZST>) }
}
bb3: {
@@ -127,11 +127,11 @@
StorageLive(_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
_25 = &_6; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
_24 = &(*_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
- _23 = core::fmt::ArgumentV1::<'_>::new_display::<u32>(move _24) -> [return: bb4, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
+ _23 = core::fmt::rt::Argument::<'_>::new_display::<u32>(move _24) -> [return: bb4, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27
// mir::Constant
// + span: $DIR/lifetimes.rs:27:24: 27:27
// + user_ty: UserType(5)
- // + literal: Const { ty: for<'b> fn(&'b u32) -> core::fmt::ArgumentV1<'b> {core::fmt::ArgumentV1::<'_>::new_display::<u32>}, val: Value(<ZST>) }
+ // + literal: Const { ty: for<'b> fn(&'b u32) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::<u32>}, val: Value(<ZST>) }
}
bb4: {
@@ -141,13 +141,13 @@
StorageDead(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_18 = &_19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_17 = &(*_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
- _16 = move _17 as &[core::fmt::ArgumentV1<'_>] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
+ _16 = move _17 as &[core::fmt::rt::Argument<'_>] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageDead(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
_11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
// mir::Constant
// + span: $SRC_DIR/std/src/macros.rs:LL:COL
// + user_ty: UserType(3)
- // + literal: Const { ty: fn(&[&'static str], &[core::fmt::ArgumentV1<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value(<ZST>) }
+ // + literal: Const { ty: fn(&[&'static str], &[core::fmt::rt::Argument<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value(<ZST>) }
}
bb5: {
diff --git a/tests/mir-opt/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir
index 8e10e70f1..5bb1a7bf0 100644
--- a/tests/mir-opt/storage_ranges.main.nll.0.mir
+++ b/tests/mir-opt/storage_ranges.main.nll.0.mir
@@ -1,21 +1,21 @@
// MIR for `main` 0 nll
| Free Region Mapping
-| '_#0r | Global | ['_#0r, '_#1r]
-| '_#1r | Local | ['_#1r]
+| '?0 | Global | ['?0, '?1]
+| '?1 | Local | ['?1]
|
| Inferred Region Values
-| '_#0r | U0 | {bb0[0..=22], '_#0r, '_#1r}
-| '_#1r | U0 | {bb0[0..=22], '_#1r}
-| '_#2r | U0 | {bb0[10..=11]}
-| '_#3r | U0 | {bb0[11]}
+| '?0 | U0 | {bb0[0..=22], '?0, '?1}
+| '?1 | U0 | {bb0[0..=22], '?1}
+| '?2 | U0 | {bb0[10..=11]}
+| '?3 | U0 | {bb0[11]}
|
| Inference Constraints
-| '_#0r live at {bb0[0..=22]}
-| '_#1r live at {bb0[0..=22]}
-| '_#2r live at {bb0[10]}
-| '_#3r live at {bb0[11]}
-| '_#2r: '_#3r due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0)
+| '?0 live at {bb0[0..=22]}
+| '?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)
|
fn main() -> () {
let mut _0: (); // return place in scope 0 at $DIR/storage_ranges.rs:+0:11: +0:11
diff --git a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
index 2af864998..4b2a16b50 100644
--- a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
+++ b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir
@@ -3,16 +3,13 @@
fn process_void(_1: *const Void) -> () {
debug input => _1; // in scope 0 at $DIR/uninhabited_enum.rs:+0:21: +0:26
let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum.rs:+0:41: +0:41
- let _2: &Void; // in scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14
scope 1 {
- debug _input => _2; // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14
+ debug _input => _1; // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14
}
scope 2 {
}
bb0: {
- StorageLive(_2); // scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14
- StorageDead(_2); // scope 0 at $DIR/uninhabited_enum.rs:+4:1: +4:2
return; // scope 0 at $DIR/uninhabited_enum.rs:+4:2: +4:2
}
}
diff --git a/tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir b/tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir
deleted file mode 100644
index 15b0aece8..000000000
--- a/tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir
+++ /dev/null
@@ -1,17 +0,0 @@
-// MIR for `change_loop_body` after PreCodegen
-
-fn change_loop_body() -> () {
- let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27
- let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15
- scope 1 {
- debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15
- scope 2 {
- }
- }
-
- bb0: {
- StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15
- StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2
- return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2
- }
-}