From 307d0d8f51e65d83274ff61072e15401ab852496 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 17 May 2020 15:39:35 +0200 Subject: [PATCH] move Deaggregate pass to post_borrowck_cleanup --- src/librustc_mir/interpret/step.rs | 4 +- src/librustc_mir/transform/const_prop.rs | 26 ++- src/librustc_mir/transform/mod.rs | 11 +- src/test/codegen/consts.rs | 4 +- .../const_prop/aggregate.main.ConstProp.diff | 4 +- .../discriminant.main.ConstProp.diff.32bit | 22 +-- .../discriminant.main.ConstProp.diff.64bit | 22 +-- .../issue_66971.main.ConstProp.diff | 9 +- .../issue_67019.main.ConstProp.diff | 24 ++- ...ble_variable_aggregate.main.ConstProp.diff | 9 +- ...able_aggregate_mut_ref.main.ConstProp.diff | 3 +- ...variable_unprop_assign.main.ConstProp.diff | 9 +- ...es_into_variable.main.ConstProp.diff.32bit | 3 +- ...es_into_variable.main.ConstProp.diff.64bit | 3 +- ...le_literal_propagation.main.ConstProp.diff | 9 +- .../const_prop_miscompile.bar.ConstProp.diff | 12 +- .../const_prop_miscompile.foo.ConstProp.diff | 12 +- ...float_to_exponential_common.ConstProp.diff | 162 ++++++++++++++++++ src/test/mir-opt/funky_arms.rs | 56 ++++++ ...main-{{closure}}.StateTransform.before.mir | 5 +- ...ny.main-{{closure}}.generator_resume.0.mir | 17 +- .../inline_closure.foo.Inline.after.mir | 12 +- ...e_closure_borrows_arg.foo.Inline.after.mir | 12 +- ...line_closure_captures.foo.Inline.after.mir | 13 +- .../issue_73223.main.PreCodegen.diff.32bit | 161 +++++++++-------- .../issue_73223.main.PreCodegen.diff.64bit | 161 +++++++++-------- ..._73223.main.SimplifyArmIdentity.diff.32bit | 16 +- ..._73223.main.SimplifyArmIdentity.diff.64bit | 16 +- ...entity.main.SimplifyArmIdentity.diff.32bit | 9 +- ...entity.main.SimplifyArmIdentity.diff.64bit | 9 +- ...ves_unused_consts.main.SimplifyLocals.diff | 42 ++--- ...minant_reads.map.SimplifyLocals.diff.32bit | 8 +- ...minant_reads.map.SimplifyLocals.diff.64bit | 8 +- ...after-uninhabited-enum-branching.after.mir | 4 +- ...anching.main.UninhabitedEnumBranching.diff | 4 +- ...oops.change_loop_body.ConstProp.diff.32bit | 84 +++++++++ ...oops.change_loop_body.ConstProp.diff.64bit | 84 +++++++++ ...hange_loop_body.PreCodegen.after.mir.32bit | 33 ++++ ...hange_loop_body.PreCodegen.after.mir.64bit | 33 ++++ src/test/mir-opt/while_let_loops.rs | 15 ++ 40 files changed, 793 insertions(+), 357 deletions(-) create mode 100644 src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff create mode 100644 src/test/mir-opt/funky_arms.rs create mode 100644 src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.32bit create mode 100644 src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.64bit create mode 100644 src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.32bit create mode 100644 src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.64bit create mode 100644 src/test/mir-opt/while_let_loops.rs diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index fcd26c86c473d..93624c32d300c 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -74,7 +74,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Ok(true) } - fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> InterpResult<'tcx> { + /// Runs the interpretation logic for the given `mir::Statement` at the current frame and + /// statement counter. This also moves the statement counter forward. + crate fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> InterpResult<'tcx> { info!("{:?}", stmt); use rustc_middle::mir::StatementKind::*; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index bff83b3c6db74..0e9d41f07aae2 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -252,6 +252,11 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine<'mir, 'tcx> throw_machine_stop_str!("tried to write to a local that is marked as not propagatable") } if frame == 0 && ecx.machine.only_propagate_inside_block_locals.contains(local) { + trace!( + "mutating local {:?} which is restricted to its block. \ + Will remove it from const-prop after block is finished.", + local + ); ecx.machine.written_only_inside_own_block_locals.insert(local); } ecx.machine.stack[frame].locals[local].access_mut() @@ -427,6 +432,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { match f(self) { Ok(val) => Some(val), Err(error) => { + trace!("InterpCx operation failed: {:?}", error); // Some errors shouldn't come up because creating them causes // an allocation, which we should avoid. When that happens, // dedicated error variants should be introduced instead. @@ -969,10 +975,10 @@ impl<'tcx> Visitor<'tcx> for CanConstProp { ConstPropMode::OnlyPropagateInto => {} other @ ConstPropMode::FullConstProp => { trace!( - "local {:?} can't be propagated because of multiple assignments", - local, + "local {:?} can't be propagated because of multiple assignments. Previous state: {:?}", + local, other, ); - *other = ConstPropMode::OnlyPropagateInto; + *other = ConstPropMode::OnlyInsideOwnBlock; } } } @@ -1089,6 +1095,20 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> { } } else { match statement.kind { + StatementKind::SetDiscriminant { ref place, .. } => { + match self.ecx.machine.can_const_prop[place.local] { + ConstPropMode::FullConstProp | ConstPropMode::OnlyInsideOwnBlock => { + if self.use_ecx(|this| this.ecx.statement(statement)).is_some() { + trace!("propped discriminant into {:?}", place); + } else { + Self::remove_const(&mut self.ecx, place.local); + } + } + ConstPropMode::OnlyPropagateInto | ConstPropMode::NoPropagation => { + Self::remove_const(&mut self.ecx, place.local); + } + } + } StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => { let frame = self.ecx.frame_mut(); frame.locals[local].value = diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 26b4a6968971d..3803ee78fd4d9 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -408,6 +408,9 @@ fn run_post_borrowck_cleanup_passes<'tcx>( // but before optimizations begin. &add_retag::AddRetag, &simplify::SimplifyCfg::new("elaborate-drops"), + // `Deaggregator` is conceptually part of MIR building, some backends rely on it happening + // and it can help optimizations. + &deaggregator::Deaggregator, ]; run_passes( @@ -439,11 +442,6 @@ fn run_optimization_passes<'tcx>( &instcombine::InstCombine, &const_prop::ConstProp, &simplify_branches::SimplifyBranches::new("after-const-prop"), - // Run deaggregation here because: - // 1. Some codegen backends require it - // 2. It creates additional possibilities for some MIR optimizations to trigger - // FIXME(#70073): Why is this done here and not in `post_borrowck_cleanup`? - &deaggregator::Deaggregator, &simplify_try::SimplifyArmIdentity, &simplify_try::SimplifyBranchSame, ©_prop::CopyPropagation, @@ -460,9 +458,6 @@ fn run_optimization_passes<'tcx>( &generator::StateTransform, // FIXME(#70073): This pass is responsible for both optimization as well as some lints. &const_prop::ConstProp, - // Even if we don't do optimizations, still run deaggregation because some backends assume - // that deaggregation always occurs. - &deaggregator::Deaggregator, ]; let pre_codegen_cleanup: &[&dyn MirPass<'tcx>] = &[ diff --git a/src/test/codegen/consts.rs b/src/test/codegen/consts.rs index ed93af2f993d3..318f9b0eec3a9 100644 --- a/src/test/codegen/consts.rs +++ b/src/test/codegen/consts.rs @@ -10,11 +10,11 @@ // CHECK: @STATIC = {{.*}}, align 4 // This checks the constants from inline_enum_const -// CHECK: @alloc7 = {{.*}}, align 2 +// CHECK: @alloc8 = {{.*}}, align 2 // This checks the constants from {low,high}_align_const, they share the same // constant, but the alignment differs, so the higher one should be used -// CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}} getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* @alloc19, i32 0, i32 0, i32 0), {{.*}} +// CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}} getelementptr inbounds (<{ [8 x i8] }>, <{ [8 x i8] }>* @alloc20, i32 0, i32 0, i32 0), {{.*}} #[derive(Copy, Clone)] // repr(i16) is required for the {low,high}_align_const test diff --git a/src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff b/src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff index e84e88b93fcd8..6992abae6c2be 100644 --- a/src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/aggregate.main.ConstProp.diff @@ -14,19 +14,21 @@ StorageLive(_1); // scope 0 at $DIR/aggregate.rs:5:9: 5:10 StorageLive(_2); // scope 0 at $DIR/aggregate.rs:5:13: 5:24 StorageLive(_3); // scope 0 at $DIR/aggregate.rs:5:13: 5:22 - _3 = (const 0_i32, const 1_i32, const 2_i32); // scope 0 at $DIR/aggregate.rs:5:13: 5:22 + (_3.0: i32) = const 0_i32; // scope 0 at $DIR/aggregate.rs:5:13: 5:22 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000000)) // mir::Constant // + span: $DIR/aggregate.rs:5:14: 5:15 // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } + (_3.1: i32) = const 1_i32; // scope 0 at $DIR/aggregate.rs:5:13: 5:22 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000001)) // mir::Constant // + span: $DIR/aggregate.rs:5:17: 5:18 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } + (_3.2: i32) = const 2_i32; // scope 0 at $DIR/aggregate.rs:5:13: 5:22 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000002)) diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.32bit b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.32bit index 539a16f52dca2..be9b24bfde8aa 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.32bit +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.32bit @@ -15,19 +15,16 @@ StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _3 = std::option::Option::::Some(const true); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -+ _3 = const std::option::Option::::Some(true); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 // ty::Const -- // + ty: bool -+ // + ty: std::option::Option + // + ty: bool // + val: Value(Scalar(0x01)) // mir::Constant -- // + span: $DIR/discriminant.rs:11:39: 11:43 -- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + span: $DIR/discriminant.rs:11:39: 11:43 + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 - switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ // + span: $DIR/discriminant.rs:11:34: 11:44 -+ // + literal: Const { ty: std::option::Option, val: Value(Scalar(0x01)) } + _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + // ty::Const + // + ty: isize @@ -56,14 +53,7 @@ } bb2: { -- switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:26: 11:30 -+ switchInt(const true) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:26: 11:30 -+ // ty::Const -+ // + ty: bool -+ // + val: Value(Scalar(0x01)) -+ // mir::Constant -+ // + span: $DIR/discriminant.rs:11:26: 11:30 -+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:26: 11:30 } bb3: { diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.64bit b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.64bit index 20875448eddc9..05b57a6c28075 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.64bit +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.diff.64bit @@ -15,19 +15,16 @@ StorageLive(_1); // scope 0 at $DIR/discriminant.rs:11:9: 11:10 StorageLive(_2); // scope 0 at $DIR/discriminant.rs:11:13: 11:64 StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -- _3 = std::option::Option::::Some(const true); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 -+ _3 = const std::option::Option::::Some(true); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 // ty::Const -- // + ty: bool -+ // + ty: std::option::Option + // + ty: bool // + val: Value(Scalar(0x01)) // mir::Constant -- // + span: $DIR/discriminant.rs:11:39: 11:43 -- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + // + span: $DIR/discriminant.rs:11:39: 11:43 + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 - switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ // + span: $DIR/discriminant.rs:11:34: 11:44 -+ // + literal: Const { ty: std::option::Option, val: Value(Scalar(0x01)) } + _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + // ty::Const + // + ty: isize @@ -56,14 +53,7 @@ } bb2: { -- switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:26: 11:30 -+ switchInt(const true) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:26: 11:30 -+ // ty::Const -+ // + ty: bool -+ // + val: Value(Scalar(0x01)) -+ // mir::Constant -+ // + span: $DIR/discriminant.rs:11:26: 11:30 -+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:26: 11:30 } bb3: { diff --git a/src/test/mir-opt/const_prop/issue_66971.main.ConstProp.diff b/src/test/mir-opt/const_prop/issue_66971.main.ConstProp.diff index 242907b5599d8..59e5b207f120c 100644 --- a/src/test/mir-opt/const_prop/issue_66971.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/issue_66971.main.ConstProp.diff @@ -11,21 +11,22 @@ StorageLive(_1); // scope 0 at $DIR/issue-66971.rs:16:5: 16:23 StorageLive(_2); // scope 0 at $DIR/issue-66971.rs:16:12: 16:22 StorageLive(_3); // scope 0 at $DIR/issue-66971.rs:16:13: 16:15 -- _3 = (); // scope 0 at $DIR/issue-66971.rs:16:13: 16:15 -+ _3 = const (); // scope 0 at $DIR/issue-66971.rs:16:13: 16:15 +- (_2.0: ()) = move _3; // scope 0 at $DIR/issue-66971.rs:16:12: 16:22 ++ (_2.0: ()) = const (); // scope 0 at $DIR/issue-66971.rs:16:12: 16:22 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant -+ // + span: $DIR/issue-66971.rs:16:13: 16:15 ++ // + span: $DIR/issue-66971.rs:16:12: 16:22 + // + literal: Const { ty: (), val: Value(Scalar()) } - _2 = (move _3, const 0_u8, const 0_u8); // scope 0 at $DIR/issue-66971.rs:16:12: 16:22 + (_2.1: u8) = const 0_u8; // scope 0 at $DIR/issue-66971.rs:16:12: 16:22 // ty::Const // + ty: u8 // + val: Value(Scalar(0x00)) // mir::Constant // + span: $DIR/issue-66971.rs:16:17: 16:18 // + literal: Const { ty: u8, val: Value(Scalar(0x00)) } + (_2.2: u8) = const 0_u8; // scope 0 at $DIR/issue-66971.rs:16:12: 16:22 // ty::Const // + ty: u8 // + val: Value(Scalar(0x00)) diff --git a/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff b/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff index d5c1105d7caff..d3e5e9fe5b422 100644 --- a/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/issue_67019.main.ConstProp.diff @@ -11,22 +11,34 @@ StorageLive(_1); // scope 0 at $DIR/issue-67019.rs:11:5: 11:20 StorageLive(_2); // scope 0 at $DIR/issue-67019.rs:11:10: 11:19 StorageLive(_3); // scope 0 at $DIR/issue-67019.rs:11:11: 11:17 - _3 = (const 1_u8, const 2_u8); // scope 0 at $DIR/issue-67019.rs:11:11: 11:17 + (_3.0: u8) = const 1_u8; // scope 0 at $DIR/issue-67019.rs:11:11: 11:17 // ty::Const // + ty: u8 // + val: Value(Scalar(0x01)) // mir::Constant -- // + span: $DIR/issue-67019.rs:11:12: 11:13 -+ // + span: $DIR/issue-67019.rs:11:11: 11:17 + // + span: $DIR/issue-67019.rs:11:12: 11:13 // + literal: Const { ty: u8, val: Value(Scalar(0x01)) } + (_3.1: u8) = const 2_u8; // scope 0 at $DIR/issue-67019.rs:11:11: 11:17 // ty::Const // + ty: u8 // + val: Value(Scalar(0x02)) // mir::Constant -- // + span: $DIR/issue-67019.rs:11:15: 11:16 -+ // + span: $DIR/issue-67019.rs:11:11: 11:17 + // + span: $DIR/issue-67019.rs:11:15: 11:16 // + literal: Const { ty: u8, val: Value(Scalar(0x02)) } - _2 = (move _3,); // scope 0 at $DIR/issue-67019.rs:11:10: 11:19 +- (_2.0: (u8, u8)) = move _3; // scope 0 at $DIR/issue-67019.rs:11:10: 11:19 ++ (_2.0: (u8, u8)) = (const 1_u8, const 2_u8); // scope 0 at $DIR/issue-67019.rs:11:10: 11:19 ++ // ty::Const ++ // + ty: u8 ++ // + val: Value(Scalar(0x01)) ++ // mir::Constant ++ // + span: $DIR/issue-67019.rs:11:10: 11:19 ++ // + literal: Const { ty: u8, val: Value(Scalar(0x01)) } ++ // ty::Const ++ // + ty: u8 ++ // + val: Value(Scalar(0x02)) ++ // mir::Constant ++ // + span: $DIR/issue-67019.rs:11:10: 11:19 ++ // + literal: Const { ty: u8, val: Value(Scalar(0x02)) } StorageDead(_3); // scope 0 at $DIR/issue-67019.rs:11:18: 11:19 _1 = const test(move _2) -> bb1; // scope 0 at $DIR/issue-67019.rs:11:5: 11:20 // ty::Const diff --git a/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff index f581b222c83cb..617702a520912 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff @@ -14,20 +14,19 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:5:9: 5:14 - _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:5:17: 5:25 + (_1.0: i32) = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:5:17: 5:25 // ty::Const // + ty: i32 // + val: Value(Scalar(0x0000002a)) // mir::Constant -- // + span: $DIR/mutable_variable_aggregate.rs:5:18: 5:20 -+ // + span: $DIR/mutable_variable_aggregate.rs:5:17: 5:25 + // + span: $DIR/mutable_variable_aggregate.rs:5:18: 5:20 // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) } + (_1.1: i32) = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:5:17: 5:25 // ty::Const // + ty: i32 // + val: Value(Scalar(0x0000002b)) // mir::Constant -- // + span: $DIR/mutable_variable_aggregate.rs:5:22: 5:24 -+ // + span: $DIR/mutable_variable_aggregate.rs:5:17: 5:25 + // + span: $DIR/mutable_variable_aggregate.rs:5:22: 5:24 // + literal: Const { ty: i32, val: Value(Scalar(0x0000002b)) } (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:6:5: 6:13 // ty::Const diff --git a/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff b/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff index 6e2ee0957ab33..dbf77cf6b378b 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff @@ -18,13 +18,14 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:9: 5:14 - _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:17: 5:25 + (_1.0: i32) = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:17: 5:25 // ty::Const // + ty: i32 // + val: Value(Scalar(0x0000002a)) // mir::Constant // + span: $DIR/mutable_variable_aggregate_mut_ref.rs:5:18: 5:20 // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) } + (_1.1: i32) = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:17: 5:25 // ty::Const // + ty: i32 // + val: Value(Scalar(0x0000002b)) diff --git a/src/test/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff b/src/test/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff index b59b180b07d7f..84e858debddc0 100644 --- a/src/test/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff @@ -34,20 +34,19 @@ bb1: { StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14 - _2 = (const 1_i32, const 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35 + (_2.0: i32) = const 1_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000001)) // mir::Constant -- // + span: $DIR/mutable_variable_unprop_assign.rs:6:30: 6:31 -+ // + span: $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35 + // + span: $DIR/mutable_variable_unprop_assign.rs:6:30: 6:31 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } + (_2.1: i32) = const 2_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000002)) // mir::Constant -- // + span: $DIR/mutable_variable_unprop_assign.rs:6:33: 6:34 -+ // + span: $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35 + // + span: $DIR/mutable_variable_unprop_assign.rs:6:33: 6:34 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12 _3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12 diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.32bit b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.32bit index 5312784bc8aae..c2381f3da90dd 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.32bit +++ b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.32bit @@ -173,13 +173,14 @@ StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35 StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10 StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 - _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 + (_9.0: u32) = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 // ty::Const // + ty: u32 // + val: Value(Scalar(0x0000000c)) // mir::Constant // + span: $DIR/optimizes_into_variable.rs:14:25: 14:27 // + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) } + (_9.1: u32) = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 // ty::Const // + ty: u32 // + val: Value(Scalar(0x0000002a)) diff --git a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.64bit b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.64bit index 7af9984136667..bc965b4ade730 100644 --- a/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.64bit +++ b/src/test/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.diff.64bit @@ -173,13 +173,14 @@ StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35 StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10 StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 - _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 + (_9.0: u32) = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 // ty::Const // + ty: u32 // + val: Value(Scalar(0x0000000c)) // mir::Constant // + span: $DIR/optimizes_into_variable.rs:14:25: 14:27 // + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) } + (_9.1: u32) = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36 // ty::Const // + ty: u32 // + val: Value(Scalar(0x0000002a)) diff --git a/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff index 941ec64a3cc12..e4a0ef27b24ed 100644 --- a/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff +++ b/src/test/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff @@ -12,20 +12,19 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:3:9: 3:10 - _1 = (const 1_u32, const 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:3:13: 3:19 + (_1.0: u32) = const 1_u32; // scope 0 at $DIR/tuple_literal_propagation.rs:3:13: 3:19 // ty::Const // + ty: u32 // + val: Value(Scalar(0x00000001)) // mir::Constant -- // + span: $DIR/tuple_literal_propagation.rs:3:14: 3:15 -+ // + span: $DIR/tuple_literal_propagation.rs:3:13: 3:19 + // + span: $DIR/tuple_literal_propagation.rs:3:14: 3:15 // + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) } + (_1.1: u32) = const 2_u32; // scope 0 at $DIR/tuple_literal_propagation.rs:3:13: 3:19 // ty::Const // + ty: u32 // + val: Value(Scalar(0x00000002)) // mir::Constant -- // + span: $DIR/tuple_literal_propagation.rs:3:17: 3:18 -+ // + span: $DIR/tuple_literal_propagation.rs:3:13: 3:19 + // + span: $DIR/tuple_literal_propagation.rs:3:17: 3:18 // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) } StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:5:5: 5:15 StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:5:13: 5:14 diff --git a/src/test/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/src/test/mir-opt/const_prop_miscompile.bar.ConstProp.diff index 5fe35b479c126..b4733b5ed39f9 100644 --- a/src/test/mir-opt/const_prop_miscompile.bar.ConstProp.diff +++ b/src/test/mir-opt/const_prop_miscompile.bar.ConstProp.diff @@ -19,17 +19,13 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:12:9: 12:14 -- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:12:17: 12:21 -+ _1 = const (1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:12:17: 12:21 + (_1.0: i32) = const 1_i32; // scope 0 at $DIR/const_prop_miscompile.rs:12:17: 12:21 // ty::Const -- // + ty: i32 -+ // + ty: (i32,) + // + ty: i32 // + val: Value(Scalar(0x00000001)) // mir::Constant -- // + span: $DIR/const_prop_miscompile.rs:12:18: 12:19 -- // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } -+ // + span: $DIR/const_prop_miscompile.rs:12:17: 12:21 -+ // + literal: Const { ty: (i32,), val: Value(Scalar(0x00000001)) } + // + span: $DIR/const_prop_miscompile.rs:12:18: 12:19 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:13:5: 15:6 StorageLive(_3); // scope 2 at $DIR/const_prop_miscompile.rs:14:10: 14:22 _3 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:14:10: 14:22 diff --git a/src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff index 98e9825c1c435..b54fc41d0b496 100644 --- a/src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff +++ b/src/test/mir-opt/const_prop_miscompile.foo.ConstProp.diff @@ -16,17 +16,13 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:5:9: 5:14 -- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:5:17: 5:21 -+ _1 = const (1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:5:17: 5:21 + (_1.0: i32) = const 1_i32; // scope 0 at $DIR/const_prop_miscompile.rs:5:17: 5:21 // ty::Const -- // + ty: i32 -+ // + ty: (i32,) + // + ty: i32 // + val: Value(Scalar(0x00000001)) // mir::Constant -- // + span: $DIR/const_prop_miscompile.rs:5:18: 5:19 -- // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } -+ // + span: $DIR/const_prop_miscompile.rs:5:17: 5:21 -+ // + literal: Const { ty: (i32,), val: Value(Scalar(0x00000001)) } + // + span: $DIR/const_prop_miscompile.rs:5:18: 5:19 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:6:6: 6:14 _2 = &mut (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:6:6: 6:14 (*_2) = const 5_i32; // scope 1 at $DIR/const_prop_miscompile.rs:6:5: 6:18 diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff new file mode 100644 index 0000000000000..5f928ea2a1629 --- /dev/null +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -0,0 +1,162 @@ +- // MIR for `float_to_exponential_common` before ConstProp ++ // MIR for `float_to_exponential_common` after ConstProp + + fn float_to_exponential_common(_1: &mut std::fmt::Formatter, _2: &T, _3: bool) -> std::result::Result<(), std::fmt::Error> { + debug fmt => _1; // in scope 0 at $DIR/funky_arms.rs:11:35: 11:38 + debug num => _2; // in scope 0 at $DIR/funky_arms.rs:11:60: 11:63 + debug upper => _3; // in scope 0 at $DIR/funky_arms.rs:11:69: 11:74 + let mut _0: std::result::Result<(), std::fmt::Error>; // return place in scope 0 at $DIR/funky_arms.rs:11:85: 11:91 + let _4: bool; // in scope 0 at $DIR/funky_arms.rs:15:9: 15:19 + let mut _5: &std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:15:22: 15:25 + let mut _7: std::option::Option; // in scope 0 at $DIR/funky_arms.rs:24:30: 24:45 + let mut _8: &std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:24:30: 24:33 + let mut _9: isize; // in scope 0 at $DIR/funky_arms.rs:24:12: 24:27 + let mut _11: &mut std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:26:43: 26:46 + let mut _12: &T; // in scope 0 at $DIR/funky_arms.rs:26:48: 26:51 + let mut _13: core::num::flt2dec::Sign; // in scope 0 at $DIR/funky_arms.rs:26:53: 26:57 + let mut _14: u32; // in scope 0 at $DIR/funky_arms.rs:26:59: 26:79 + let mut _15: u32; // in scope 0 at $DIR/funky_arms.rs:26:59: 26:75 + let mut _16: usize; // in scope 0 at $DIR/funky_arms.rs:26:59: 26:68 + let mut _17: bool; // in scope 0 at $DIR/funky_arms.rs:26:81: 26:86 + let mut _18: &mut std::fmt::Formatter; // in scope 0 at $DIR/funky_arms.rs:28:46: 28:49 + let mut _19: &T; // in scope 0 at $DIR/funky_arms.rs:28:51: 28:54 + let mut _20: core::num::flt2dec::Sign; // in scope 0 at $DIR/funky_arms.rs:28:56: 28:60 + let mut _21: bool; // in scope 0 at $DIR/funky_arms.rs:28:62: 28:67 + scope 1 { + debug force_sign => _4; // in scope 1 at $DIR/funky_arms.rs:15:9: 15:19 + let _6: core::num::flt2dec::Sign; // in scope 1 at $DIR/funky_arms.rs:19:9: 19:13 + scope 2 { + debug sign => _6; // in scope 2 at $DIR/funky_arms.rs:19:9: 19:13 + let _10: usize; // in scope 2 at $DIR/funky_arms.rs:24:17: 24:26 + scope 3 { + debug precision => _10; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + } + } + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/funky_arms.rs:15:9: 15:19 + StorageLive(_5); // scope 0 at $DIR/funky_arms.rs:15:22: 15:25 + _5 = &(*_1); // scope 0 at $DIR/funky_arms.rs:15:22: 15:25 + _4 = const std::fmt::Formatter::sign_plus(move _5) -> bb1; // scope 0 at $DIR/funky_arms.rs:15:22: 15:37 + // ty::Const + // + ty: for<'r> fn(&'r std::fmt::Formatter) -> bool {std::fmt::Formatter::sign_plus} + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/funky_arms.rs:15:26: 15:35 + // + literal: Const { ty: for<'r> fn(&'r std::fmt::Formatter) -> bool {std::fmt::Formatter::sign_plus}, val: Value(Scalar()) } + } + + bb1: { + StorageDead(_5); // scope 0 at $DIR/funky_arms.rs:15:36: 15:37 + StorageLive(_6); // scope 1 at $DIR/funky_arms.rs:19:9: 19:13 + switchInt(_4) -> [false: bb3, otherwise: bb2]; // scope 1 at $DIR/funky_arms.rs:20:9: 20:14 + } + + bb2: { + discriminant(_6) = 2; // scope 1 at $DIR/funky_arms.rs:21:17: 21:41 + goto -> bb4; // scope 1 at $DIR/funky_arms.rs:19:16: 22:6 + } + + bb3: { + discriminant(_6) = 0; // scope 1 at $DIR/funky_arms.rs:20:18: 20:38 + goto -> bb4; // scope 1 at $DIR/funky_arms.rs:19:16: 22:6 + } + + bb4: { + StorageLive(_7); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_8); // scope 2 at $DIR/funky_arms.rs:24:30: 24:33 + _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:33 + _7 = const std::fmt::Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + // ty::Const + // + ty: for<'r> fn(&'r std::fmt::Formatter) -> std::option::Option {std::fmt::Formatter::precision} + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/funky_arms.rs:24:34: 24:43 + // + literal: Const { ty: for<'r> fn(&'r std::fmt::Formatter) -> std::option::Option {std::fmt::Formatter::precision}, val: Value(Scalar()) } + } + + bb5: { + StorageDead(_8); // scope 2 at $DIR/funky_arms.rs:24:44: 24:45 + _9 = discriminant(_7); // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb7, otherwise: bb6]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + } + + bb6: { + StorageLive(_18); // scope 2 at $DIR/funky_arms.rs:28:46: 28:49 + _18 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:28:46: 28:49 + StorageLive(_19); // scope 2 at $DIR/funky_arms.rs:28:51: 28:54 + _19 = _2; // scope 2 at $DIR/funky_arms.rs:28:51: 28:54 + StorageLive(_20); // scope 2 at $DIR/funky_arms.rs:28:56: 28:60 + _20 = _6; // scope 2 at $DIR/funky_arms.rs:28:56: 28:60 + StorageLive(_21); // scope 2 at $DIR/funky_arms.rs:28:62: 28:67 + _21 = _3; // scope 2 at $DIR/funky_arms.rs:28:62: 28:67 + _0 = const float_to_exponential_common_shortest::(move _18, move _19, move _20, move _21) -> bb9; // scope 2 at $DIR/funky_arms.rs:28:9: 28:68 + // ty::Const + // + ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_shortest::} + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/funky_arms.rs:28:9: 28:45 + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_shortest::}, val: Value(Scalar()) } + } + + bb7: { + StorageLive(_10); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 + _10 = ((_7 as Some).0: usize); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 + StorageLive(_11); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + _11 = &mut (*_1); // scope 3 at $DIR/funky_arms.rs:26:43: 26:46 + StorageLive(_12); // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + _12 = _2; // scope 3 at $DIR/funky_arms.rs:26:48: 26:51 + StorageLive(_13); // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + _13 = _6; // scope 3 at $DIR/funky_arms.rs:26:53: 26:57 + StorageLive(_14); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + StorageLive(_15); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageLive(_16); // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _16 = _10; // scope 3 at $DIR/funky_arms.rs:26:59: 26:68 + _15 = move _16 as u32 (Misc); // scope 3 at $DIR/funky_arms.rs:26:59: 26:75 + StorageDead(_16); // scope 3 at $DIR/funky_arms.rs:26:74: 26:75 + _14 = Add(move _15, const 1_u32); // scope 3 at $DIR/funky_arms.rs:26:59: 26:79 + // ty::Const + // + ty: u32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/funky_arms.rs:26:78: 26:79 + // + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) } + StorageDead(_15); // scope 3 at $DIR/funky_arms.rs:26:78: 26:79 + StorageLive(_17); // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _17 = _3; // scope 3 at $DIR/funky_arms.rs:26:81: 26:86 + _0 = const float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> bb8; // scope 3 at $DIR/funky_arms.rs:26:9: 26:87 + // ty::Const + // + ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, u32, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_exact::} + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/funky_arms.rs:26:9: 26:42 + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, u32, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_exact::}, val: Value(Scalar()) } + } + + bb8: { + StorageDead(_17); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_14); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_13); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_12); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_11); // scope 3 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_10); // scope 2 at $DIR/funky_arms.rs:27:5: 27:6 + goto -> bb10; // scope 2 at $DIR/funky_arms.rs:24:5: 29:6 + } + + bb9: { + StorageDead(_21); // scope 2 at $DIR/funky_arms.rs:28:67: 28:68 + StorageDead(_20); // scope 2 at $DIR/funky_arms.rs:28:67: 28:68 + StorageDead(_19); // scope 2 at $DIR/funky_arms.rs:28:67: 28:68 + StorageDead(_18); // scope 2 at $DIR/funky_arms.rs:28:67: 28:68 + goto -> bb10; // scope 2 at $DIR/funky_arms.rs:24:5: 29:6 + } + + bb10: { + StorageDead(_6); // scope 1 at $DIR/funky_arms.rs:30:1: 30:2 + StorageDead(_4); // scope 0 at $DIR/funky_arms.rs:30:1: 30:2 + StorageDead(_7); // scope 0 at $DIR/funky_arms.rs:30:1: 30:2 + return; // scope 0 at $DIR/funky_arms.rs:30:2: 30:2 + } + } + diff --git a/src/test/mir-opt/funky_arms.rs b/src/test/mir-opt/funky_arms.rs new file mode 100644 index 0000000000000..3e70d85e0d47f --- /dev/null +++ b/src/test/mir-opt/funky_arms.rs @@ -0,0 +1,56 @@ +// compile-flags: --crate-type lib -Cdebug-assertions=no + +#![feature(flt2dec)] + +extern crate core; + +use core::num::flt2dec; +use std::fmt::{Formatter, Result}; + +// EMIT_MIR funky_arms.float_to_exponential_common.ConstProp.diff +fn float_to_exponential_common(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result +where + T: flt2dec::DecodableFloat, +{ + let force_sign = fmt.sign_plus(); + // A bug in const propagation (never reached master, but during dev of a PR) caused the + // `sign = Minus` assignment to get propagated into all future reads of `sign`. This is + // wrong because `sign` could also have `MinusPlus` value. + let sign = match force_sign { + false => flt2dec::Sign::Minus, + true => flt2dec::Sign::MinusPlus, + }; + + if let Some(precision) = fmt.precision() { + // 1 integral digit + `precision` fractional digits = `precision + 1` total digits + float_to_exponential_common_exact(fmt, num, sign, precision as u32 + 1, upper) + } else { + float_to_exponential_common_shortest(fmt, num, sign, upper) + } +} +#[inline(never)] +fn float_to_exponential_common_exact( + fmt: &mut Formatter<'_>, + num: &T, + sign: flt2dec::Sign, + precision: u32, + upper: bool, +) -> Result +where + T: flt2dec::DecodableFloat, +{ + unimplemented!() +} + +#[inline(never)] +fn float_to_exponential_common_shortest( + fmt: &mut Formatter<'_>, + num: &T, + sign: flt2dec::Sign, + upper: bool, +) -> Result +where + T: flt2dec::DecodableFloat, +{ + unimplemented!() +} diff --git a/src/test/mir-opt/generator_storage_dead_unwind.main-{{closure}}.StateTransform.before.mir b/src/test/mir-opt/generator_storage_dead_unwind.main-{{closure}}.StateTransform.before.mir index 7dcfda32ca4a2..356470f8fec87 100644 --- a/src/test/mir-opt/generator_storage_dead_unwind.main-{{closure}}.StateTransform.before.mir +++ b/src/test/mir-opt/generator_storage_dead_unwind.main-{{closure}}.StateTransform.before.mir @@ -21,7 +21,7 @@ yields () bb0: { StorageLive(_3); // scope 0 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14 - _3 = Foo(const 5_i32); // scope 0 at $DIR/generator-storage-dead-unwind.rs:23:17: 23:23 + (_3.0: i32) = const 5_i32; // scope 0 at $DIR/generator-storage-dead-unwind.rs:23:17: 23:23 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000005)) @@ -29,7 +29,7 @@ yields () // + span: $DIR/generator-storage-dead-unwind.rs:23:21: 23:22 // + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) } StorageLive(_4); // scope 1 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14 - _4 = Bar(const 6_i32); // scope 1 at $DIR/generator-storage-dead-unwind.rs:24:17: 24:23 + (_4.0: i32) = const 6_i32; // scope 1 at $DIR/generator-storage-dead-unwind.rs:24:17: 24:23 // ty::Const // + ty: i32 // + val: Value(Scalar(0x00000006)) @@ -38,7 +38,6 @@ yields () // + literal: Const { ty: i32, val: Value(Scalar(0x00000006)) } StorageLive(_5); // scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14 StorageLive(_6); // scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14 - _6 = (); // scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14 _5 = yield(move _6) -> [resume: bb2, drop: bb4]; // scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14 } diff --git a/src/test/mir-opt/generator_tiny.main-{{closure}}.generator_resume.0.mir b/src/test/mir-opt/generator_tiny.main-{{closure}}.generator_resume.0.mir index 8776e5919bd8d..41fc04774dbca 100644 --- a/src/test/mir-opt/generator_tiny.main-{{closure}}.generator_resume.0.mir +++ b/src/test/mir-opt/generator_tiny.main-{{closure}}.generator_resume.0.mir @@ -1,17 +1,13 @@ // MIR for `main::{{closure}}#0` 0 generator_resume /* generator_layout = GeneratorLayout { - field_tys: { - _0: HasDrop, - }, + field_tys: {}, variant_fields: { Unresumed(0): [], Returned (1): [], Panicked (2): [], - Suspend0 (3): [_0], - }, - storage_conflicts: BitMatrix(1x1) { - (_0, _0), + Suspend0 (3): [], }, + storage_conflicts: BitMatrix(0x0) {}, } */ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs:19:16: 25:6 {u8, HasDrop, ()}]>, _2: u8) -> std::ops::GeneratorState<(), ()> { @@ -27,7 +23,7 @@ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs: let _10: u8; // in scope 0 at $DIR/generator-tiny.rs:19:17: 19:19 let mut _11: u32; // in scope 0 at $DIR/generator-tiny.rs:19:16: 25:6 scope 1 { - debug _d => (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator-tiny.rs:20:13: 20:15 + debug _d => _3; // in scope 1 at $DIR/generator-tiny.rs:20:13: 20:15 } bb0: { @@ -37,8 +33,7 @@ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs: bb1: { _10 = move _2; // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6 - nop; // scope 0 at $DIR/generator-tiny.rs:20:13: 20:15 - (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop) = HasDrop; // scope 0 at $DIR/generator-tiny.rs:20:18: 20:25 + StorageLive(_3); // scope 0 at $DIR/generator-tiny.rs:20:13: 20:15 StorageLive(_4); // scope 1 at $DIR/generator-tiny.rs:21:9: 24:10 goto -> bb2; // scope 1 at $DIR/generator-tiny.rs:21:9: 24:10 } @@ -46,7 +41,6 @@ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs: bb2: { StorageLive(_6); // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18 StorageLive(_7); // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18 - _7 = (); // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18 _0 = std::ops::GeneratorState::<(), ()>::Yielded(move _7); // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18 discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6 {u8, HasDrop, ()}]))) = 3; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18 return; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18 @@ -78,6 +72,7 @@ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs: } bb5: { + StorageLive(_3); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6 StorageLive(_4); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6 StorageLive(_6); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6 StorageLive(_7); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6 diff --git a/src/test/mir-opt/inline/inline_closure.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure.foo.Inline.after.mir index bd0ec8c7ddbd5..b40a8047c4185 100644 --- a/src/test/mir-opt/inline/inline_closure.foo.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_closure.foo.Inline.after.mir @@ -21,15 +21,6 @@ fn foo(_1: T, _2: i32) -> i32 { bb0: { StorageLive(_3); // scope 0 at $DIR/inline-closure.rs:11:9: 11:10 - _3 = [closure@foo::::{{closure}}#0]; // scope 0 at $DIR/inline-closure.rs:11:13: 11:24 - // closure - // + def_id: DefId(0:6 ~ inline_closure[317d]::foo[0]::{{closure}}[0]) - // + substs: [ - // T, - // i8, - // extern "rust-call" fn((i32, i32)) -> i32, - // (), - // ] StorageLive(_4); // scope 1 at $DIR/inline-closure.rs:12:5: 12:6 _4 = &_3; // scope 1 at $DIR/inline-closure.rs:12:5: 12:6 StorageLive(_5); // scope 1 at $DIR/inline-closure.rs:12:5: 12:12 @@ -37,7 +28,8 @@ fn foo(_1: T, _2: i32) -> i32 { _6 = _2; // scope 1 at $DIR/inline-closure.rs:12:7: 12:8 StorageLive(_7); // scope 1 at $DIR/inline-closure.rs:12:10: 12:11 _7 = _2; // scope 1 at $DIR/inline-closure.rs:12:10: 12:11 - _5 = (move _6, move _7); // scope 1 at $DIR/inline-closure.rs:12:5: 12:12 + (_5.0: i32) = move _6; // scope 1 at $DIR/inline-closure.rs:12:5: 12:12 + (_5.1: i32) = move _7; // scope 1 at $DIR/inline-closure.rs:12:5: 12:12 _8 = move (_5.0: i32); // scope 1 at $DIR/inline-closure.rs:12:5: 12:12 _9 = move (_5.1: i32); // scope 1 at $DIR/inline-closure.rs:12:5: 12:12 _0 = _8; // scope 2 at $DIR/inline-closure.rs:11:22: 11:24 diff --git a/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir index cea3c59a3e479..f6dd741364039 100644 --- a/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir @@ -24,15 +24,6 @@ fn foo(_1: T, _2: &i32) -> i32 { bb0: { StorageLive(_3); // scope 0 at $DIR/inline-closure-borrows-arg.rs:12:9: 12:10 - _3 = [closure@foo::::{{closure}}#0]; // scope 0 at $DIR/inline-closure-borrows-arg.rs:12:13: 15:6 - // closure - // + def_id: DefId(0:6 ~ inline_closure_borrows_arg[317d]::foo[0]::{{closure}}[0]) - // + substs: [ - // T, - // i8, - // for<'r, 's> extern "rust-call" fn((&'r i32, &'s i32)) -> i32, - // (), - // ] StorageLive(_4); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:6 _4 = &_3; // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:6 StorageLive(_5); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 @@ -40,7 +31,8 @@ fn foo(_1: T, _2: &i32) -> i32 { _6 = &(*_2); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:7: 16:8 StorageLive(_7); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:10: 16:11 _7 = &(*_2); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:10: 16:11 - _5 = (move _6, move _7); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 + (_5.0: &i32) = move _6; // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 + (_5.1: &i32) = move _7; // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 _8 = move (_5.0: &i32); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 _9 = move (_5.1: &i32); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 _0 = (*_8); // scope 3 at $DIR/inline-closure-borrows-arg.rs:14:9: 14:18 diff --git a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index eeff914ccffb9..e2b5d6567c299 100644 --- a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -28,15 +28,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) { _4 = &_2; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 StorageLive(_5); // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 _5 = &_1; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 - _3 = [closure@foo::::{{closure}}#0] { q: move _4, t: move _5 }; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 - // closure - // + def_id: DefId(0:6 ~ inline_closure_captures[317d]::foo[0]::{{closure}}[0]) - // + substs: [ - // T, - // i8, - // extern "rust-call" fn((i32,)) -> (i32, T), - // (&i32, &T), - // ] + (_3.0: &i32) = move _4; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 + (_3.1: &T) = move _5; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 StorageDead(_5); // scope 0 at $DIR/inline-closure-captures.rs:11:23: 11:24 StorageDead(_4); // scope 0 at $DIR/inline-closure-captures.rs:11:23: 11:24 StorageLive(_6); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:6 @@ -44,7 +37,7 @@ fn foo(_1: T, _2: i32) -> (i32, T) { StorageLive(_7); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageLive(_8); // scope 1 at $DIR/inline-closure-captures.rs:12:7: 12:8 _8 = _2; // scope 1 at $DIR/inline-closure-captures.rs:12:7: 12:8 - _7 = (move _8,); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 + (_7.0: i32) = move _8; // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 _11 = move (_7.0: i32); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageLive(_9); // scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20 _9 = (*((*_6).0: &i32)); // scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20 diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.diff.32bit b/src/test/mir-opt/issue_73223.main.PreCodegen.diff.32bit index 4c9da471f0b94..919c37a5fc341 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.diff.32bit +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.diff.32bit @@ -11,22 +11,20 @@ let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _13: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _14: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _15: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _17: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _18: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _19: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _21: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _22: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _12: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _13: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _14: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _15: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _16: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _17: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _18: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _19: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _25: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _26: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _28: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _29: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _2; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -37,28 +35,28 @@ scope 4 { debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _24: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _25: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _22: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _23: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _25; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg0 => _22; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 6 { - debug x => _24; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _27; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _30: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _31: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _22; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _25; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _28: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _29: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL } scope 8 { - debug x => _25; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _29; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _32: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _33: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _27; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _30: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _31: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL } } scope 10 { - debug pieces => _15; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug args => _16; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _34: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + debug pieces => _14; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug args => _15; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _32: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL } } } @@ -103,16 +101,18 @@ StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _7 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _8 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _11 = (*_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = (*_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = Eq(move _11, move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _9 = Not(move _10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -121,7 +121,6 @@ bb1: { StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 @@ -136,40 +135,38 @@ } bb2: { - StorageLive(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _15 = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _14 = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) } + StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _19 = &_20; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _20 = &_21; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = &_23; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_19.0: &&i32) = move _20; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - (_19.1: &&i32) = move _22; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _24 = (_19.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = (_19.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _27 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = &_8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_18.0: &&i32) = move _19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_18.1: &&i32) = move _21; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _22 = (_18.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = (_18.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _25 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt} // + val: Value(Scalar()) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_30); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _30 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _28 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _25) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>} // + val: Value(Scalar()) @@ -179,8 +176,8 @@ } bb3: { - StorageLive(_31); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _31 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _24) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _29 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _22) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>} // + val: Value(Scalar()) @@ -190,20 +187,20 @@ } bb4: { - (_26.0: &core::fmt::Opaque) = move _31; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_26.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _30; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_31); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_30); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageLive(_28); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _29 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_24.0: &core::fmt::Opaque) = move _29; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_24.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _28; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _27 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt} // + val: Value(Scalar()) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_32); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _32 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _29) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _30 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>} // + val: Value(Scalar()) @@ -213,8 +210,8 @@ } bb5: { - StorageLive(_33); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _33 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _31 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>} // + val: Value(Scalar()) @@ -224,23 +221,23 @@ } bb6: { - (_28.0: &core::fmt::Opaque) = move _33; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_28.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _32; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_33); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_32); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _18 = [move _26, move _28]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_28); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + (_26.0: &core::fmt::Opaque) = move _31; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_26.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _30; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _17 = [move _24, move _26]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL StorageDead(_26); // scope 5 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 &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_34); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - discriminant(_34) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_14.0: &[&str]) = move _15; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_14.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _34; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_14.2: &[std::fmt::ArgumentV1]) = move _16; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_34); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _13 = &_14; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - const std::rt::begin_panic_fmt(move _13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _16 = &_17; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _15 = move _16 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + discriminant(_32) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_13.0: &[&str]) = move _14; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _32; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_13.2: &[std::fmt::ArgumentV1]) = move _15; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + const std::rt::begin_panic_fmt(move _12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL // ty::Const // + ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt} // + val: Value(Scalar()) diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.diff.64bit b/src/test/mir-opt/issue_73223.main.PreCodegen.diff.64bit index 4c9da471f0b94..919c37a5fc341 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.diff.64bit +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.diff.64bit @@ -11,22 +11,20 @@ let mut _9: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _11: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _13: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _14: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _15: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _17: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _18: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _19: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _21: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _22: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _12: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _13: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _14: &[&str]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _15: &[std::fmt::ArgumentV1]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _16: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _17: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _18: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _19: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _21: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _24: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _25: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _26: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _27: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _28: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _29: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _2; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 @@ -37,28 +35,28 @@ scope 4 { debug left_val => _7; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _24: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _25: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _22: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _23: &&i32; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _24; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _25; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg0 => _22; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 6 { - debug x => _24; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _27; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _30: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _31: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _22; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _25; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _28: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _29: &core::fmt::Opaque; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL } scope 8 { - debug x => _25; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _29; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _32: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _33: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _27; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _30: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _31: &core::fmt::Opaque; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL } } scope 10 { - debug pieces => _15; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug args => _16; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _34: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + debug pieces => _14; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug args => _15; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _32: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL } } } @@ -103,16 +101,18 @@ StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _7 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _8 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _11 = (*_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = (*_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = Eq(move _11, move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = Eq(move _11, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _9 = Not(move _10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -121,7 +121,6 @@ bb1: { StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_5); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 @@ -136,40 +135,38 @@ } bb2: { - StorageLive(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _15 = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _14 = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) } + StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_19); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _19 = &_20; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_21); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = _7; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _20 = &_21; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = &_23; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_19.0: &&i32) = move _20; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - (_19.1: &&i32) = move _22; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _24 = (_19.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = (_19.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _27 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = &_8; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_18.0: &&i32) = move _19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_18.1: &&i32) = move _21; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _22 = (_18.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = (_18.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _25 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt} // + val: Value(Scalar()) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_30); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _30 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _28 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _25) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>} // + val: Value(Scalar()) @@ -179,8 +176,8 @@ } bb3: { - StorageLive(_31); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _31 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _24) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _29 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _22) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>} // + val: Value(Scalar()) @@ -190,20 +187,20 @@ } bb4: { - (_26.0: &core::fmt::Opaque) = move _31; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_26.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _30; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_31); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_30); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageLive(_28); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _29 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_24.0: &core::fmt::Opaque) = move _29; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_24.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _28; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_29); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_28); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_26); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _27 = const <&i32 as std::fmt::Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt} // + val: Value(Scalar()) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_32); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _32 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _29) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _30 = const std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _27) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>} // + val: Value(Scalar()) @@ -213,8 +210,8 @@ } bb5: { - StorageLive(_33); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _33 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _31 = const std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // ty::Const // + ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>} // + val: Value(Scalar()) @@ -224,23 +221,23 @@ } bb6: { - (_28.0: &core::fmt::Opaque) = move _33; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_28.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _32; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_33); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_32); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _18 = [move _26, move _28]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_28); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + (_26.0: &core::fmt::Opaque) = move _31; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_26.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _30; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_31); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_30); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _17 = [move _24, move _26]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL StorageDead(_26); // scope 5 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 &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_34); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - discriminant(_34) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_14.0: &[&str]) = move _15; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_14.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _34; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_14.2: &[std::fmt::ArgumentV1]) = move _16; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_34); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _13 = &_14; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - const std::rt::begin_panic_fmt(move _13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_24); // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _16 = &_17; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _15 = move _16 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + discriminant(_32) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_13.0: &[&str]) = move _14; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_13.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _32; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_13.2: &[std::fmt::ArgumentV1]) = move _15; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_32); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + const std::rt::begin_panic_fmt(move _12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL // ty::Const // + ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt} // + val: Value(Scalar()) diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.32bit b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.32bit index dd0e8f4b2ad4f..28d949be271e8 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.32bit +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.32bit @@ -165,8 +165,20 @@ StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _17 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = (*_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = Eq(move _17, move _18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = const 1_i32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } + _16 = Eq(move _17, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageDead(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.64bit b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.64bit index d465f60f34d7c..2b854850deaf1 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.64bit +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff.64bit @@ -165,8 +165,20 @@ StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _17 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = (*_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = Eq(move _17, move _18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = const 1_i32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } + _16 = Eq(move _17, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } StorageDead(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL diff --git a/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.32bit b/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.32bit index 0de80f72a1e70..b7b239ea414d6 100644 --- a/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.32bit +++ b/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.32bit @@ -39,13 +39,14 @@ } bb1: { - _2 = const Dst::Foo(0_u8); // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32 + ((_2 as Foo).0: u8) = const 0_u8; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32 // ty::Const - // + ty: Dst + // + ty: u8 // + val: Value(Scalar(0x00)) // mir::Constant - // + span: $DIR/simplify-arm-identity.rs:21:21: 21:32 - // + literal: Const { ty: Dst, val: Value(Scalar(0x00)) } + // + span: $DIR/simplify-arm-identity.rs:21:30: 21:31 + // + literal: Const { ty: u8, val: Value(Scalar(0x00)) } + discriminant(_2) = 0; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32 goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6 } diff --git a/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.64bit b/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.64bit index 4fa0aff8fa0ef..34282526da0fa 100644 --- a/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.64bit +++ b/src/test/mir-opt/simplify_arm_identity.main.SimplifyArmIdentity.diff.64bit @@ -39,13 +39,14 @@ } bb1: { - _2 = const Dst::Foo(0_u8); // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32 + ((_2 as Foo).0: u8) = const 0_u8; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32 // ty::Const - // + ty: Dst + // + ty: u8 // + val: Value(Scalar(0x00)) // mir::Constant - // + span: $DIR/simplify-arm-identity.rs:21:21: 21:32 - // + literal: Const { ty: Dst, val: Value(Scalar(0x00)) } + // + span: $DIR/simplify-arm-identity.rs:21:30: 21:31 + // + literal: Const { ty: u8, val: Value(Scalar(0x00)) } + discriminant(_2) = 0; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32 goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6 } diff --git a/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff index db06b0392df6c..8b5936116b3a7 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff @@ -22,58 +22,44 @@ bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:20: 13:28 - StorageLive(_2); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:21: 13:23 -- _2 = const (); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:21: 13:23 +- StorageLive(_3); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:25: 13:27 +- (_1.0: ()) = const (); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:20: 13:28 + StorageLive(_1); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:5: 14:22 + _1 = const use_zst(const ((), ())) -> bb1; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:5: 14:22 // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant -- // + span: $DIR/simplify-locals-removes-unused-consts.rs:13:21: 13:23 +- // + span: $DIR/simplify-locals-removes-unused-consts.rs:13:20: 13:28 - // + literal: Const { ty: (), val: Value(Scalar()) } -- StorageLive(_3); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:25: 13:27 -- _3 = const (); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:25: 13:27 +- (_1.1: ()) = const (); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:20: 13:28 - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant -- // + span: $DIR/simplify-locals-removes-unused-consts.rs:13:25: 13:27 -- // + literal: Const { ty: (), val: Value(Scalar()) } -- _1 = const ((), ()); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:20: 13:28 -- // ty::Const -- // + ty: ((), ()) -- // + val: Value(Scalar()) -- // mir::Constant - // + span: $DIR/simplify-locals-removes-unused-consts.rs:13:20: 13:28 -- // + literal: Const { ty: ((), ()), val: Value(Scalar()) } +- // + literal: Const { ty: (), val: Value(Scalar()) } - StorageDead(_3); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:27: 13:28 - StorageDead(_2); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:27: 13:28 - StorageDead(_1); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:13:28: 13:29 - StorageLive(_4); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:5: 14:22 - StorageLive(_5); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:13: 14:21 - StorageLive(_6); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:14: 14:16 -- _6 = const (); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:14: 14:16 -- // ty::Const -- // + ty: () -- // + val: Value(Scalar()) -- // mir::Constant -- // + span: $DIR/simplify-locals-removes-unused-consts.rs:14:14: 14:16 -- // + literal: Const { ty: (), val: Value(Scalar()) } - StorageLive(_7); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:18: 14:20 -- _7 = const (); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:18: 14:20 +- (_5.0: ()) = const (); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:13: 14:21 - // ty::Const - // + ty: () - // + val: Value(Scalar()) - // mir::Constant -- // + span: $DIR/simplify-locals-removes-unused-consts.rs:14:18: 14:20 +- // + span: $DIR/simplify-locals-removes-unused-consts.rs:14:13: 14:21 - // + literal: Const { ty: (), val: Value(Scalar()) } -- _5 = const ((), ()); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:13: 14:21 +- (_5.1: ()) = const (); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:13: 14:21 - // ty::Const -- // + ty: ((), ()) +- // + ty: () - // + val: Value(Scalar()) - // mir::Constant - // + span: $DIR/simplify-locals-removes-unused-consts.rs:14:13: 14:21 -- // + literal: Const { ty: ((), ()), val: Value(Scalar()) } +- // + literal: Const { ty: (), val: Value(Scalar()) } - StorageDead(_7); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:20: 14:21 - StorageDead(_6); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:20: 14:21 - _4 = const use_zst(const ((), ())) -> bb1; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:5: 14:22 @@ -98,16 +84,16 @@ - StorageLive(_9); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:34 - StorageLive(_10); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:30 - StorageLive(_11); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 -- _11 = const Temp { x: 40_u8 }; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 +- (_11.0: u8) = const 40_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 + StorageDead(_1); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:14:22: 14:23 + StorageLive(_2); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:5: 16:35 + _2 = const use_u8(const 42_u8) -> bb2; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:5: 16:35 // ty::Const -- // + ty: Temp +- // + ty: u8 - // + val: Value(Scalar(0x28)) - // mir::Constant -- // + span: $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:28 -- // + literal: Const { ty: Temp, val: Value(Scalar(0x28)) } +- // + span: $DIR/simplify-locals-removes-unused-consts.rs:16:23: 16:25 +- // + literal: Const { ty: u8, val: Value(Scalar(0x28)) } - _10 = const 40_u8; // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:12: 16:30 - // ty::Const - // + ty: u8 diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.32bit b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.32bit index 440c5f8772ed1..0bd13e009ddc8 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.32bit +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.32bit @@ -39,13 +39,7 @@ } bb2: { - _0 = const std::option::Option::>::None; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 - // ty::Const - // + ty: std::option::Option> - // + val: Value(Scalar(0x00000000)) - // mir::Constant - // + span: $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 - // + literal: Const { ty: std::option::Option>, val: Value(Scalar(0x00000000)) } + discriminant(_0) = 0; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 goto -> bb3; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:2:5: 5:6 } diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.64bit b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.64bit index c12d1715b486d..0bd13e009ddc8 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.64bit +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff.64bit @@ -39,13 +39,7 @@ } bb2: { - _0 = const std::option::Option::>::None; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 - // ty::Const - // + ty: std::option::Option> - // + val: Value(Scalar(0x0000000000000000)) - // mir::Constant - // + span: $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 - // + literal: Const { ty: std::option::Option>, val: Value(Scalar(0x0000000000000000)) } + discriminant(_0) = 0; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 goto -> bb3; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:2:5: 5:6 } diff --git a/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir b/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir index 4f4fb7defc379..24fd26591bd82 100644 --- a/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir +++ b/src/test/mir-opt/uninhabited_enum_branching.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir @@ -15,7 +15,7 @@ fn main() -> () { bb0: { StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6 StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19 - _2 = Test1::C; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19 + discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19 _3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:21:9: 21:20 StorageLive(_5); // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24 _5 = const "C"; // scope 0 at $DIR/uninhabited_enum_branching.rs:23:21: 23:24 @@ -31,7 +31,7 @@ fn main() -> () { StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:24:6: 24:7 StorageLive(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6 StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19 - _7 = Test2::D; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19 + discriminant(_7) = 0; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19 _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:27:9: 27:17 switchInt(move _8) -> [4_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/uninhabited_enum_branching.rs:27:9: 27:17 } diff --git a/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff b/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff index d262c9432ca83..7e0a95edf3e7d 100644 --- a/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff +++ b/src/test/mir-opt/uninhabited_enum_branching.main.UninhabitedEnumBranching.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:5: 24:6 StorageLive(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19 - _2 = Test1::C; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19 + discriminant(_2) = 2; // scope 0 at $DIR/uninhabited_enum_branching.rs:20:11: 20:19 _3 = discriminant(_2); // scope 0 at $DIR/uninhabited_enum_branching.rs:21:9: 21:20 - switchInt(move _3) -> [0_isize: bb2, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/uninhabited_enum_branching.rs:21:9: 21:20 + switchInt(move _3) -> bb1; // scope 0 at $DIR/uninhabited_enum_branching.rs:21:9: 21:20 @@ -66,7 +66,7 @@ StorageDead(_1); // scope 0 at $DIR/uninhabited_enum_branching.rs:24:6: 24:7 StorageLive(_6); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:5: 29:6 StorageLive(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19 - _7 = Test2::D; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19 + discriminant(_7) = 0; // scope 0 at $DIR/uninhabited_enum_branching.rs:26:11: 26:19 _8 = discriminant(_7); // scope 0 at $DIR/uninhabited_enum_branching.rs:27:9: 27:17 switchInt(move _8) -> [4_isize: bb6, otherwise: bb5]; // scope 0 at $DIR/uninhabited_enum_branching.rs:27:9: 27:17 } diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.32bit b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.32bit new file mode 100644 index 0000000000000..ff98b0e32268a --- /dev/null +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.32bit @@ -0,0 +1,84 @@ +- // MIR for `change_loop_body` before ConstProp ++ // MIR for `change_loop_body` after ConstProp + + fn change_loop_body() -> () { + let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27 + let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + let mut _2: (); // in scope 0 at $DIR/while_let_loops.rs:5:1: 11:2 + let mut _3: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:7:28: 7:32 + let mut _4: isize; // in scope 0 at $DIR/while_let_loops.rs:7:15: 7:25 + let mut _5: !; // in scope 0 at $DIR/while_let_loops.rs:7:33: 10:6 + let mut _6: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 + scope 1 { + debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/while_let_loops.rs:6:18: 6:19 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } + StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ // ty::Const ++ // + ty: isize ++ // + val: Value(Scalar(0x00000000)) ++ // mir::Constant ++ // + span: $DIR/while_let_loops.rs:7:15: 7:25 ++ // + literal: Const { ty: isize, val: Value(Scalar(0x00000000)) } ++ switchInt(const 0_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ // ty::Const ++ // + ty: isize ++ // + val: Value(Scalar(0x00000000)) ++ // mir::Constant ++ // + span: $DIR/while_let_loops.rs:7:15: 7:25 ++ // + literal: Const { ty: isize, val: Value(Scalar(0x00000000)) } + } + + bb1: { + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while_let_loops.rs:7:5: 10:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + } + + bb2: { + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb3, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:20: 7:24 + } + + bb3: { + _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/while_let_loops.rs:8:14: 8:15 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while_let_loops.rs:9:9: 9:14 + // + literal: Const { ty: (), val: Value(Scalar()) } + goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + } + + bb4: { + StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 + StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 + return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2 + } + } + diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.64bit b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.64bit new file mode 100644 index 0000000000000..612d44f413fe7 --- /dev/null +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff.64bit @@ -0,0 +1,84 @@ +- // MIR for `change_loop_body` before ConstProp ++ // MIR for `change_loop_body` after ConstProp + + fn change_loop_body() -> () { + let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:5:27: 5:27 + let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + let mut _2: (); // in scope 0 at $DIR/while_let_loops.rs:5:1: 11:2 + let mut _3: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:7:28: 7:32 + let mut _4: isize; // in scope 0 at $DIR/while_let_loops.rs:7:15: 7:25 + let mut _5: !; // in scope 0 at $DIR/while_let_loops.rs:7:33: 10:6 + let mut _6: !; // in scope 0 at $DIR/while_let_loops.rs:7:5: 10:6 + scope 1 { + debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/while_let_loops.rs:6:18: 6:19 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } + StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ // ty::Const ++ // + ty: isize ++ // + val: Value(Scalar(0x0000000000000000)) ++ // mir::Constant ++ // + span: $DIR/while_let_loops.rs:7:15: 7:25 ++ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000000)) } ++ switchInt(const 0_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ // ty::Const ++ // + ty: isize ++ // + val: Value(Scalar(0x0000000000000000)) ++ // mir::Constant ++ // + span: $DIR/while_let_loops.rs:7:15: 7:25 ++ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000000)) } + } + + bb1: { + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while_let_loops.rs:7:5: 10:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + } + + bb2: { + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb3, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:20: 7:24 + } + + bb3: { + _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000001)) + // mir::Constant + // + span: $DIR/while_let_loops.rs:8:14: 8:15 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while_let_loops.rs:9:9: 9:14 + // + literal: Const { ty: (), val: Value(Scalar()) } + goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + } + + bb4: { + StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 + StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 + return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2 + } + } + diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.32bit b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.32bit new file mode 100644 index 0000000000000..f6fe12489199d --- /dev/null +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.32bit @@ -0,0 +1,33 @@ +// 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:5:27: 5:27 + let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + let mut _2: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:7:28: 7:32 + scope 1 { + debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/while_let_loops.rs:6:18: 6:19 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } + StorageLive(_2); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_2) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while_let_loops.rs:7:5: 10:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_2); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 + StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 + return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2 + } +} diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.64bit b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.64bit new file mode 100644 index 0000000000000..f6fe12489199d --- /dev/null +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir.64bit @@ -0,0 +1,33 @@ +// 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:5:27: 5:27 + let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + let mut _2: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:7:28: 7:32 + scope 1 { + debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 + _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:6:18: 6:19 + // ty::Const + // + ty: i32 + // + val: Value(Scalar(0x00000000)) + // mir::Constant + // + span: $DIR/while_let_loops.rs:6:18: 6:19 + // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) } + StorageLive(_2); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_2) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/while_let_loops.rs:7:5: 10:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + StorageDead(_2); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 + StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 + return; // scope 0 at $DIR/while_let_loops.rs:11:2: 11:2 + } +} diff --git a/src/test/mir-opt/while_let_loops.rs b/src/test/mir-opt/while_let_loops.rs new file mode 100644 index 0000000000000..f320a218c852c --- /dev/null +++ b/src/test/mir-opt/while_let_loops.rs @@ -0,0 +1,15 @@ +// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff +// EMIT_MIR while_let_loops.change_loop_body.PreCodegen.after.mir +// EMIT_MIR_FOR_EACH_BIT_WIDTH + +pub fn change_loop_body() { + let mut _x = 0; + while let Some(0u32) = None { + _x = 1; + break; + } +} + +fn main() { + change_loop_body(); +}