From b48f3d86fcd797eb3d654bb570e1623e610e7dc1 Mon Sep 17 00:00:00 2001 From: Xavier Denis Date: Thu, 9 Jun 2022 11:06:44 -0700 Subject: [PATCH 1/6] Fix `SourceScope` for `if let` bindings. --- .../rustc_mir_build/src/build/expr/into.rs | 5 ++- .../rustc_mir_build/src/build/matches/mod.rs | 32 ++++++++++++---- .../discriminant.main.ConstProp.64bit.diff | 20 +++++----- ...ness.no_downcast.EarlyOtherwiseBranch.diff | 16 ++++---- ...float_to_exponential_common.ConstProp.diff | 20 +++++----- .../issue_41888.main.ElaborateDrops.after.mir | 12 +++--- ...e_75439.foo.MatchBranchSimplification.diff | 20 +++++----- ..._locals_fixedpoint.foo.SimplifyLocals.diff | 38 +++++++++---------- ...reachable.main.UnreachablePropagation.diff | 16 ++++---- ...diverging.main.UnreachablePropagation.diff | 16 ++++---- ...oops.change_loop_body.ConstProp.64bit.diff | 18 +++++---- ...hange_loop_body.PreCodegen.after.64bit.mir | 2 + 12 files changed, 121 insertions(+), 94 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index ccbb518e72d08..ea677d727e017 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -70,8 +70,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - then_expr.span, + then_expr.span )); + this.expr_into_dest(destination, then_blk, then_expr) }); then_block.and(else_block) @@ -97,7 +98,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Let { expr, ref pat } => { let scope = this.local_scope(); let (true_block, false_block) = this.in_if_then_scope(scope, |this| { - this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span) + this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span) }); this.cfg.push_assign_constant( diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 43a84f69699aa..ce25a89a2749b 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -41,7 +41,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, temp_scope_override: Option, break_scope: region::Scope, - variable_scope_span: Span, + variable_span: Span, ) -> BlockAnd<()> { let this = self; let expr_span = expr.span; @@ -53,7 +53,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[lhs], temp_scope_override, break_scope, - variable_scope_span, + variable_span, )); let rhs_then_block = unpack!(this.then_else_break( @@ -61,7 +61,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[rhs], temp_scope_override, break_scope, - variable_scope_span, + variable_span, )); rhs_then_block.unit() @@ -74,12 +74,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[value], temp_scope_override, break_scope, - variable_scope_span, + variable_span, ) }) } ExprKind::Let { expr, ref pat } => { - this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span) + let variable_scope = + this.new_source_scope(variable_span, LintLevel::Inherited, None); + this.source_scope = variable_scope; + this.lower_let_expr( + block, + &this.thir[expr], + pat, + break_scope, + Some(variable_scope), + variable_span, + ) } _ => { let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); @@ -1773,6 +1783,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, pat: &Pat<'tcx>, else_target: region::Scope, + source_scope: Option, span: Span, ) -> BlockAnd<()> { let expr_span = expr.span; @@ -1798,7 +1809,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let otherwise_post_guard_block = otherwise_candidate.pre_binding_block.unwrap(); self.break_for_else(otherwise_post_guard_block, else_target, self.source_info(expr_span)); - self.declare_bindings(None, pat.span.to(span), pat, ArmHasGuard(false), opt_expr_place); + self.declare_bindings( + source_scope, + pat.span.to(span), + pat, + ArmHasGuard(false), + opt_expr_place, + ); + let post_guard_block = self.bind_pattern( self.source_info(pat.span), guard_candidate, @@ -1975,7 +1993,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Guard::IfLet(ref pat, scrutinee) => { let s = &this.thir[scrutinee]; guard_span = s.span; - this.lower_let_expr(block, s, pat, match_scope, arm_span) + this.lower_let_expr(block, s, pat, match_scope, None, arm_span) } }); diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 445732f70220a..a773ca246dd61 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -10,22 +10,24 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { 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 - Deinit(_3); // 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 - 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: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 1efaba044ecf1..d77056e6316f2 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -7,18 +7,20 @@ let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:20: 13:30 let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 let mut _4: &E; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:12:16: 12:17 + scope 1 { + } bb0: { - _3 = discriminant((*_1)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb1: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _4 = move (((*_1) as Some).0: &E); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _2 = discriminant((*_4)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _4 = move (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb2: { 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 index f22fbec03d000..2e0df0a6ba9f7 100644 --- 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 @@ -27,9 +27,9 @@ 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 + let _10: usize; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 } } } @@ -63,24 +63,24 @@ } 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:45 - _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _7 = Formatter::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 // mir::Constant // + span: $DIR/funky_arms.rs:24:34: 24:43 // + literal: Const { ty: for<'r> fn(&'r Formatter) -> Option {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: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:24:44: 24:45 + _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { - 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(_10); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 + _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 StorageLive(_11); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 _11 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 StorageLive(_12); // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 54930937c9103..3c662a8681406 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -14,9 +14,9 @@ fn main() -> () { let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:15:1: 15:2 scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 - let _6: K; // in scope 1 at $DIR/issue-41888.rs:10:21: 10:23 scope 2 { debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -51,14 +51,14 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 + StorageLive(_6); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 299529ec649d8..a194cddd52a60 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,9 +10,9 @@ let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35 scope 1 { debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15 - let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29 scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 } scope 4 { } @@ -32,15 +32,15 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { @@ -54,15 +54,15 @@ } bb5: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb6: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + StorageLive(_4); // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + _4 = _2[3 of 4]; // scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + goto -> bb4; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb7: { diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index a8cc61f052656..7137e01fae3b9 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -8,38 +8,38 @@ let mut _3: std::option::Option; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26 let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20 - let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageLive(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - Deinit(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - discriminant(_2) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - StorageLive(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.0: std::option::Option) = move _2; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.1: std::option::Option) = move _3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - _5 = discriminant((_1.0: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + StorageLive(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageLive(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + Deinit(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + discriminant(_2) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + StorageLive(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + discriminant(_3) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.0: std::option::Option) = move _2; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.1: std::option::Option) = move _3; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageDead(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + StorageDead(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + _5 = discriminant((_1.0: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb1: { - _4 = discriminant((_1.1: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + _4 = discriminant((_1.1: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb2: { - StorageLive(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + StorageLive(_6); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - StorageLive(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - StorageLive(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 - _8 = _6; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index 08312bde20f51..fa8fd0a3c1170 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,35 +5,35 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 - let _3: Empty; // in scope 0 at $DIR/unreachable.rs:9:17: 9:19 let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 + let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 } scope 2 { debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable.rs:9:23: 9:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable.rs:9:23: 9:30 + StorageLive(_1); // scope 1 at $DIR/unreachable.rs:9:23: 9:30 + _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:9:23: 9:30 // mir::Constant // + span: $DIR/unreachable.rs:9:23: 9:28 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -+ goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 + _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 ++ goto -> bb2; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { -- StorageLive(_3); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 -- _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 +- StorageLive(_3); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 +- _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 - StorageLive(_4); // scope 0 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index e5867ccfc5cb6..48c9f6bf27159 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -11,31 +11,31 @@ let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:18:9: 18:22 scope 1 { debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:13:9: 13:10 - let _4: Empty; // in scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 } } bb0: { StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:13:9: 13:10 _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:13:13: 13:17 - StorageLive(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 - _2 = empty() -> bb1; // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 + StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 + _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 // mir::Constant // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -+ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 + _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { - StorageLive(_4); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 - _4 = move ((_2 as Some).0: Empty); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 + StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 StorageLive(_5); // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 StorageLive(_6); // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 _6 = _1; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index 0529b15522ea6..d6156eaaf4823 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -13,22 +13,24 @@ let mut _8: !; // 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 + scope 2 { + } } 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 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_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: bb1, otherwise: bb3]; // 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 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index 3c94fbddc4421..5657f9413a1b4 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { From 53deccf06941942139a0226df43426bbe90acbb3 Mon Sep 17 00:00:00 2001 From: Xavier Denis Date: Thu, 9 Jun 2022 16:23:06 -0700 Subject: [PATCH 2/6] More minimal changes --- .../rustc_mir_build/src/build/expr/into.rs | 5 ++- .../rustc_mir_build/src/build/matches/mod.rs | 36 +++++++------------ .../discriminant.main.ConstProp.64bit.diff | 20 +++++------ ...ness.no_downcast.EarlyOtherwiseBranch.diff | 16 ++++----- ...float_to_exponential_common.ConstProp.diff | 16 ++++----- .../issue_41888.main.ElaborateDrops.after.mir | 6 ++-- ...e_75439.foo.MatchBranchSimplification.diff | 8 ++--- ..._locals_fixedpoint.foo.SimplifyLocals.diff | 34 +++++++++--------- ...reachable.main.UnreachablePropagation.diff | 12 +++---- ...diverging.main.UnreachablePropagation.diff | 12 +++---- ...oops.change_loop_body.ConstProp.64bit.diff | 18 +++++----- ...hange_loop_body.PreCodegen.after.64bit.mir | 2 -- 12 files changed, 82 insertions(+), 103 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index ea677d727e017..ccbb518e72d08 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -70,9 +70,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - then_expr.span + then_expr.span, )); - this.expr_into_dest(destination, then_blk, then_expr) }); then_block.and(else_block) @@ -98,7 +97,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Let { expr, ref pat } => { let scope = this.local_scope(); let (true_block, false_block) = this.in_if_then_scope(scope, |this| { - this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span) + this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span) }); this.cfg.push_assign_constant( diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index ce25a89a2749b..117af1a781e4a 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -41,7 +41,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, temp_scope_override: Option, break_scope: region::Scope, - variable_span: Span, + variable_scope_span: Span, ) -> BlockAnd<()> { let this = self; let expr_span = expr.span; @@ -53,7 +53,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[lhs], temp_scope_override, break_scope, - variable_span, + variable_scope_span, )); let rhs_then_block = unpack!(this.then_else_break( @@ -61,7 +61,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[rhs], temp_scope_override, break_scope, - variable_span, + variable_scope_span, )); rhs_then_block.unit() @@ -74,22 +74,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[value], temp_scope_override, break_scope, - variable_span, + variable_scope_span, ) }) } ExprKind::Let { expr, ref pat } => { - let variable_scope = - this.new_source_scope(variable_span, LintLevel::Inherited, None); - this.source_scope = variable_scope; - this.lower_let_expr( - block, - &this.thir[expr], - pat, - break_scope, - Some(variable_scope), - variable_span, - ) + this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span) } _ => { let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); @@ -1783,7 +1773,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, pat: &Pat<'tcx>, else_target: region::Scope, - source_scope: Option, span: Span, ) -> BlockAnd<()> { let expr_span = expr.span; @@ -1809,13 +1798,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let otherwise_post_guard_block = otherwise_candidate.pre_binding_block.unwrap(); self.break_for_else(otherwise_post_guard_block, else_target, self.source_info(expr_span)); - self.declare_bindings( - source_scope, - pat.span.to(span), - pat, - ArmHasGuard(false), - opt_expr_place, - ); + let scope = + self.declare_bindings(None, pat.span.to(span), pat, ArmHasGuard(false), opt_expr_place); + + if let Some(scope) = scope { + self.source_scope = scope; + } let post_guard_block = self.bind_pattern( self.source_info(pat.span), @@ -1993,7 +1981,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Guard::IfLet(ref pat, scrutinee) => { let s = &this.thir[scrutinee]; guard_span = s.span; - this.lower_let_expr(block, s, pat, match_scope, None, arm_span) + this.lower_let_expr(block, s, pat, match_scope, arm_span) } }); diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index a773ca246dd61..445732f70220a 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -10,24 +10,22 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } - scope 2 { - } bb0: { 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 2 at $DIR/discriminant.rs:11:34: 11:44 - Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 - ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 - discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 -- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 0 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // 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 + 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: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index d77056e6316f2..1efaba044ecf1 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -7,20 +7,18 @@ let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:20: 13:30 let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 let mut _4: &E; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:12:16: 12:17 - scope 1 { - } bb0: { - _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _3 = discriminant((*_1)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb1: { - StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _4 = move (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _4 = move (((*_1) as Some).0: &E); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _2 = discriminant((*_4)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb2: { 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 index 2e0df0a6ba9f7..c49bef159b4ab 100644 --- 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 @@ -27,9 +27,9 @@ 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 - let _10: usize; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 } } } @@ -63,19 +63,19 @@ } bb4: { - StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 - StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 - _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 - _7 = Formatter::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + 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:45 + _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + _7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 // mir::Constant // + span: $DIR/funky_arms.rs:24:34: 24:43 // + literal: Const { ty: for<'r> fn(&'r Formatter) -> Option {Formatter::precision}, val: Value(Scalar()) } } bb5: { - StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:24:44: 24:45 - _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 - switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 + 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: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 3c662a8681406..9defa0dcf397e 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -14,9 +14,9 @@ fn main() -> () { let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:15:1: 15:2 scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 + let _6: K; // in scope 1 at $DIR/issue-41888.rs:10:21: 10:23 scope 2 { debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 - let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -51,8 +51,8 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index a194cddd52a60..8466014c9381c 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,9 +10,9 @@ let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35 scope 1 { debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15 + let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29 scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 - let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 } scope 4 { } @@ -32,15 +32,15 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index 7137e01fae3b9..32de7f68b3e3c 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -8,33 +8,33 @@ let mut _3: std::option::Option; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26 let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20 + let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 } bb0: { - StorageLive(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageLive(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - Deinit(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - discriminant(_2) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - StorageLive(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - discriminant(_3) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.0: std::option::Option) = move _2; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.1: std::option::Option) = move _3; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageDead(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - StorageDead(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - _5 = discriminant((_1.0: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + StorageLive(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageLive(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + Deinit(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + discriminant(_2) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + StorageLive(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.0: std::option::Option) = move _2; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.1: std::option::Option) = move _3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + _5 = discriminant((_1.0: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb1: { - _4 = discriminant((_1.1: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + _4 = discriminant((_1.1: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb2: { diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index fa8fd0a3c1170..ee841fb6c5a05 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,30 +5,30 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 + let _3: Empty; // in scope 0 at $DIR/unreachable.rs:9:17: 9:19 let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 - let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 } scope 2 { debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 } bb0: { - StorageLive(_1); // scope 1 at $DIR/unreachable.rs:9:23: 9:30 - _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:9:23: 9:30 + StorageLive(_1); // scope 0 at $DIR/unreachable.rs:9:23: 9:30 + _1 = empty() -> bb1; // scope 0 at $DIR/unreachable.rs:9:23: 9:30 // mir::Constant // + span: $DIR/unreachable.rs:9:23: 9:28 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 -+ goto -> bb2; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 + _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 ++ goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index 48c9f6bf27159..91e90906557ca 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -11,26 +11,26 @@ let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:18:9: 18:22 scope 1 { debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:13:9: 13:10 + let _4: Empty; // in scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 - let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 } } bb0: { StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:13:9: 13:10 _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:13:13: 13:17 - StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 - _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 + StorageLive(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 + _2 = empty() -> bb1; // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 // mir::Constant // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 -- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 -+ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 + _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index d6156eaaf4823..0529b15522ea6 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -13,24 +13,22 @@ let mut _8: !; // 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 - scope 2 { - } } 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 - StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 - discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 -- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 -+ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_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: bb1, otherwise: bb3]; // 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 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index 5657f9413a1b4..3c94fbddc4421 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -5,8 +5,6 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 - scope 2 { - } } bb0: { From cc75f0e5dab9e11056a177cf60d25586983a4050 Mon Sep 17 00:00:00 2001 From: Xavier Denis Date: Thu, 9 Jun 2022 23:09:04 -0700 Subject: [PATCH 3/6] Revert "More minimal changes" This reverts commit fe0dedcb06947317d41a8570b7fff7f8690dcbff. --- .../rustc_mir_build/src/build/expr/into.rs | 5 +-- .../rustc_mir_build/src/build/matches/mod.rs | 36 ++++++++++++------- .../discriminant.main.ConstProp.64bit.diff | 20 ++++++----- ...ness.no_downcast.EarlyOtherwiseBranch.diff | 16 +++++---- ...float_to_exponential_common.ConstProp.diff | 16 ++++----- .../issue_41888.main.ElaborateDrops.after.mir | 6 ++-- ...e_75439.foo.MatchBranchSimplification.diff | 8 ++--- ..._locals_fixedpoint.foo.SimplifyLocals.diff | 34 +++++++++--------- ...reachable.main.UnreachablePropagation.diff | 12 +++---- ...diverging.main.UnreachablePropagation.diff | 12 +++---- ...oops.change_loop_body.ConstProp.64bit.diff | 18 +++++----- ...hange_loop_body.PreCodegen.after.64bit.mir | 2 ++ 12 files changed, 103 insertions(+), 82 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index ccbb518e72d08..ea677d727e017 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -70,8 +70,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - then_expr.span, + then_expr.span )); + this.expr_into_dest(destination, then_blk, then_expr) }); then_block.and(else_block) @@ -97,7 +98,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Let { expr, ref pat } => { let scope = this.local_scope(); let (true_block, false_block) = this.in_if_then_scope(scope, |this| { - this.lower_let_expr(block, &this.thir[expr], pat, scope, expr_span) + this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span) }); this.cfg.push_assign_constant( diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 117af1a781e4a..ce25a89a2749b 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -41,7 +41,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, temp_scope_override: Option, break_scope: region::Scope, - variable_scope_span: Span, + variable_span: Span, ) -> BlockAnd<()> { let this = self; let expr_span = expr.span; @@ -53,7 +53,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[lhs], temp_scope_override, break_scope, - variable_scope_span, + variable_span, )); let rhs_then_block = unpack!(this.then_else_break( @@ -61,7 +61,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[rhs], temp_scope_override, break_scope, - variable_scope_span, + variable_span, )); rhs_then_block.unit() @@ -74,12 +74,22 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[value], temp_scope_override, break_scope, - variable_scope_span, + variable_span, ) }) } ExprKind::Let { expr, ref pat } => { - this.lower_let_expr(block, &this.thir[expr], pat, break_scope, variable_scope_span) + let variable_scope = + this.new_source_scope(variable_span, LintLevel::Inherited, None); + this.source_scope = variable_scope; + this.lower_let_expr( + block, + &this.thir[expr], + pat, + break_scope, + Some(variable_scope), + variable_span, + ) } _ => { let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); @@ -1773,6 +1783,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, pat: &Pat<'tcx>, else_target: region::Scope, + source_scope: Option, span: Span, ) -> BlockAnd<()> { let expr_span = expr.span; @@ -1798,12 +1809,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let otherwise_post_guard_block = otherwise_candidate.pre_binding_block.unwrap(); self.break_for_else(otherwise_post_guard_block, else_target, self.source_info(expr_span)); - let scope = - self.declare_bindings(None, pat.span.to(span), pat, ArmHasGuard(false), opt_expr_place); - - if let Some(scope) = scope { - self.source_scope = scope; - } + self.declare_bindings( + source_scope, + pat.span.to(span), + pat, + ArmHasGuard(false), + opt_expr_place, + ); let post_guard_block = self.bind_pattern( self.source_info(pat.span), @@ -1981,7 +1993,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Guard::IfLet(ref pat, scrutinee) => { let s = &this.thir[scrutinee]; guard_span = s.span; - this.lower_let_expr(block, s, pat, match_scope, arm_span) + this.lower_let_expr(block, s, pat, match_scope, None, arm_span) } }); diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index 445732f70220a..a773ca246dd61 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -10,22 +10,24 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { 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 - Deinit(_3); // 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 - 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: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index 1efaba044ecf1..d77056e6316f2 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -7,18 +7,20 @@ let mut _2: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:20: 13:30 let mut _3: isize; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 let mut _4: &E; // in scope 0 at $DIR/early_otherwise_branch_soundness.rs:12:16: 12:17 + scope 1 { + } bb0: { - _3 = discriminant((*_1)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _3 = discriminant((*_1)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _3) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb1: { - StorageLive(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _4 = move (((*_1) as Some).0: &E); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - _2 = discriminant((*_4)); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageLive(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _4 = move (((*_1) as Some).0: &E); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + _2 = discriminant((*_4)); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + StorageDead(_4); // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:12: 13:31 } bb2: { 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 index c49bef159b4ab..2e0df0a6ba9f7 100644 --- 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 @@ -27,9 +27,9 @@ 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 + let _10: usize; // in scope 3 at $DIR/funky_arms.rs:24:17: 24:26 } } } @@ -63,19 +63,19 @@ } 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:45 - _8 = &(*_1); // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 - _7 = Formatter::precision(move _8) -> bb5; // scope 2 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_7); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + StorageLive(_8); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _8 = &(*_1); // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 + _7 = Formatter::precision(move _8) -> bb5; // scope 3 at $DIR/funky_arms.rs:24:30: 24:45 // mir::Constant // + span: $DIR/funky_arms.rs:24:34: 24:43 // + literal: Const { ty: for<'r> fn(&'r Formatter) -> Option {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: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + StorageDead(_8); // scope 3 at $DIR/funky_arms.rs:24:44: 24:45 + _9 = discriminant(_7); // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 3 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 9defa0dcf397e..3c662a8681406 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -14,9 +14,9 @@ fn main() -> () { let mut _11: isize; // in scope 0 at $DIR/issue-41888.rs:15:1: 15:2 scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 - let _6: K; // in scope 1 at $DIR/issue-41888.rs:10:21: 10:23 scope 2 { debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -51,8 +51,8 @@ fn main() -> () { bb4: { StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 8466014c9381c..a194cddd52a60 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -10,9 +10,9 @@ let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:10:33: 10:35 scope 1 { debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:7:9: 7:15 - let _4: u32; // in scope 1 at $DIR/issue-75439.rs:9:27: 9:29 scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 + let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 } scope 4 { } @@ -32,15 +32,15 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 3 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index 32de7f68b3e3c..7137e01fae3b9 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -8,33 +8,33 @@ let mut _3: std::option::Option; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26 let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20 - let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageLive(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - Deinit(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - discriminant(_2) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 - StorageLive(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - discriminant(_3) = 0; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 - Deinit(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.0: std::option::Option) = move _2; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - (_1.1: std::option::Option) = move _3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 - StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 - _5 = discriminant((_1.0: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + StorageLive(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageLive(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + Deinit(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + discriminant(_2) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:31: 4:49 + StorageLive(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + discriminant(_3) = 0; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:51: 4:68 + Deinit(_1); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.0: std::option::Option) = move _2; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + (_1.1: std::option::Option) = move _3; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:30: 4:69 + StorageDead(_3); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + StorageDead(_2); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69 + _5 = discriminant((_1.0: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb1: { - _4 = discriminant((_1.1: std::option::Option)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 - switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + _4 = discriminant((_1.1: std::option::Option)); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 + switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:12: 4:27 } bb2: { diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index ee841fb6c5a05..fa8fd0a3c1170 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,30 +5,30 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 - let _3: Empty; // in scope 0 at $DIR/unreachable.rs:9:17: 9:19 let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 + let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 } scope 2 { debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 } bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable.rs:9:23: 9:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable.rs:9:23: 9:30 + StorageLive(_1); // scope 1 at $DIR/unreachable.rs:9:23: 9:30 + _1 = empty() -> bb1; // scope 1 at $DIR/unreachable.rs:9:23: 9:30 // mir::Constant // + span: $DIR/unreachable.rs:9:23: 9:28 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -+ goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 + _2 = discriminant(_1); // scope 1 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 ++ goto -> bb2; // scope 1 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index 91e90906557ca..48c9f6bf27159 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -11,26 +11,26 @@ let mut _7: !; // in scope 0 at $DIR/unreachable_diverging.rs:18:9: 18:22 scope 1 { debug x => _1; // in scope 1 at $DIR/unreachable_diverging.rs:13:9: 13:10 - let _4: Empty; // in scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 } } bb0: { StorageLive(_1); // scope 0 at $DIR/unreachable_diverging.rs:13:9: 13:10 _1 = const true; // scope 0 at $DIR/unreachable_diverging.rs:13:13: 13:17 - StorageLive(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 - _2 = empty() -> bb1; // scope 1 at $DIR/unreachable_diverging.rs:14:25: 14:32 + StorageLive(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 + _2 = empty() -> bb1; // scope 2 at $DIR/unreachable_diverging.rs:14:25: 14:32 // mir::Constant // + span: $DIR/unreachable_diverging.rs:14:25: 14:30 // + literal: Const { ty: fn() -> Option {empty}, val: Value(Scalar()) } } bb1: { - _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 -+ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 + _3 = discriminant(_2); // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 2 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index 0529b15522ea6..d6156eaaf4823 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -13,22 +13,24 @@ let mut _8: !; // 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 + scope 2 { + } } 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 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_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: bb1, otherwise: bb3]; // 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 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir index 3c94fbddc4421..5657f9413a1b4 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { From e39c92e7aa2cd77659d504b05ad59e38388866f7 Mon Sep 17 00:00:00 2001 From: Xavier Denis Date: Thu, 9 Jun 2022 23:16:56 -0700 Subject: [PATCH 4/6] Actually fix --- .../rustc_mir_build/src/build/expr/into.rs | 5 +- .../rustc_mir_build/src/build/matches/mod.rs | 37 +++--- .../bool_compare.opt1.InstCombine.diff | 18 +-- .../bool_compare.opt2.InstCombine.diff | 18 +-- .../bool_compare.opt3.InstCombine.diff | 18 +-- .../bool_compare.opt4.InstCombine.diff | 18 +-- .../const_goto.issue_77355_opt.ConstGoto.diff | 24 ++-- ...oto_storage.match_nested_if.ConstGoto.diff | 52 +++++---- ...l_flow_simplification.hello.ConstProp.diff | 16 +-- ...simplification.hello.PreCodegen.before.mir | 2 + .../discriminant.main.ConstProp.64bit.diff | 2 +- .../cycle.cycle.DeadStoreElimination.diff | 60 +++++----- ...egator_test_enum_2.test1.Deaggregator.diff | 22 ++-- .../branch.main.DestinationPropagation.diff | 10 +- ...ness.no_downcast.EarlyOtherwiseBranch.diff | 2 +- .../mir-opt/equal_true.opt.InstCombine.diff | 18 +-- ...float_to_exponential_common.ConstProp.diff | 44 ++++---- ...t_opt_bool.SimplifyComparisonIntegral.diff | 10 +- ...opt_floats.SimplifyComparisonIntegral.diff | 16 +-- ...t.opt_char.SimplifyComparisonIntegral.diff | 26 +++-- ...int.opt_i8.SimplifyComparisonIntegral.diff | 26 +++-- ...ltiple_ifs.SimplifyComparisonIntegral.diff | 52 +++++---- ...t_negative.SimplifyComparisonIntegral.diff | 26 +++-- ...nt.opt_u32.SimplifyComparisonIntegral.diff | 26 +++-- .../inline/inline_diverging.g.Inline.diff | 30 ++--- .../inline/inline_generator.main.Inline.diff | 10 +- ...e_38669.main.SimplifyCfg-initial.after.mir | 10 +- .../issue_41888.main.ElaborateDrops.after.mir | 70 ++++++------ .../issue_73223.main.PreCodegen.64bit.diff | 52 ++++----- ..._73223.main.SimplifyArmIdentity.64bit.diff | 66 +++++------ ...ue_59352.num_to_digit.PreCodegen.after.mir | 106 +++++++++--------- ...e_75439.foo.MatchBranchSimplification.diff | 14 +-- ....main.SimplifyCfg-promote-consts.after.mir | 12 +- ...wer_array_len.array_bound.InstCombine.diff | 60 +++++----- ...ray_len.array_bound.NormalizeArrayLen.diff | 58 +++++----- ..._array_len.array_bound.SimplifyLocals.diff | 62 +++++----- ...array_len.array_bound_mut.InstCombine.diff | 58 +++++----- ...len.array_bound_mut.NormalizeArrayLen.diff | 58 +++++----- ...ay_len.array_bound_mut.SimplifyLocals.diff | 62 +++++----- ...wer_intrinsics.f_u64.PreCodegen.before.mir | 4 +- ...er_intrinsics.f_unit.PreCodegen.before.mir | 10 +- ...er_slice_len.bound.LowerSliceLenCalls.diff | 44 ++++---- ...fg-initial.after-ElaborateDrops.after.diff | 30 ++--- ...s.foo.MatchBranchSimplification.64bit.diff | 16 +-- ...e_branches.foo.PreCodegen.before.64bit.mir | 2 + ...ed_if.MatchBranchSimplification.64bit.diff | 22 ++-- ...nators.test.MultipleReturnTerminators.diff | 2 + ...egion_subtyping_basic.main.nll.0.64bit.mir | 22 ++-- .../not_equal_false.opt.InstCombine.diff | 18 +-- ...asts.SimplifyCfg-elaborate-drops.after.mir | 70 ++++++------ ...mplify_cfg.main.SimplifyCfg-early-opt.diff | 14 ++- ...simplify_cfg.main.SimplifyCfg-initial.diff | 18 +-- ...mplifyConstCondition-after-const-prop.diff | 18 +-- ..._locals_fixedpoint.foo.SimplifyLocals.diff | 14 ++- ...reachable.main.UnreachablePropagation.diff | 22 ++-- ...diverging.main.UnreachablePropagation.diff | 28 ++--- ...oops.change_loop_body.ConstProp.64bit.diff | 6 +- ...le_storage.while_loop.PreCodegen.after.mir | 34 +++--- 58 files changed, 895 insertions(+), 775 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index ea677d727e017..182a9a5cc5d06 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -63,6 +63,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { (if_then_scope, then_source_info), LintLevel::Inherited, |this| { + let variable_scope = + this.new_source_scope(then_expr.span, LintLevel::Inherited, None); + this.source_scope = variable_scope; let (then_block, else_block) = this.in_if_then_scope(condition_scope, |this| { let then_blk = unpack!(this.then_else_break( @@ -70,7 +73,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - then_expr.span + SourceInfo { span: then_expr.span, scope: variable_scope } )); this.expr_into_dest(destination, then_blk, then_expr) diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index ce25a89a2749b..9d5c262ed3025 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -41,7 +41,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { expr: &Expr<'tcx>, temp_scope_override: Option, break_scope: region::Scope, - variable_span: Span, + variable_source_info: SourceInfo, ) -> BlockAnd<()> { let this = self; let expr_span = expr.span; @@ -53,7 +53,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[lhs], temp_scope_override, break_scope, - variable_span, + variable_source_info, )); let rhs_then_block = unpack!(this.then_else_break( @@ -61,7 +61,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[rhs], temp_scope_override, break_scope, - variable_span, + variable_source_info, )); rhs_then_block.unit() @@ -74,23 +74,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[value], temp_scope_override, break_scope, - variable_span, + variable_source_info, ) }) } - ExprKind::Let { expr, ref pat } => { - let variable_scope = - this.new_source_scope(variable_span, LintLevel::Inherited, None); - this.source_scope = variable_scope; - this.lower_let_expr( - block, - &this.thir[expr], - pat, - break_scope, - Some(variable_scope), - variable_span, - ) - } + ExprKind::Let { expr, ref pat } => this.lower_let_expr( + block, + &this.thir[expr], + pat, + break_scope, + Some(variable_source_info.scope), + variable_source_info.span, + ), _ => { let temp_scope = temp_scope_override.unwrap_or_else(|| this.local_scope()); let mutability = Mutability::Mut; @@ -1988,7 +1983,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Guard::If(e) => { let e = &this.thir[e]; guard_span = e.span; - this.then_else_break(block, e, None, match_scope, arm_span) + this.then_else_break( + block, + e, + None, + match_scope, + this.source_info(arm_span), + ) } Guard::IfLet(ref pat, scrutinee) => { let s = &this.thir[scrutinee]; diff --git a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff index 8f57d307abf58..ff608f7f5cebf 100644 --- a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff @@ -6,19 +6,21 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:2:21: 2:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:3:8: 3:17 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:3:8: 3:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:3:8: 3:9 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:3:8: 3:9 -- _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:3:16: 3:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 + StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 + StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:3:8: 3:9 + _3 = _1; // scope 1 at $DIR/bool_compare.rs:3:8: 3:9 +- _2 = Ne(move _3, const true); // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 ++ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 + StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:3:16: 3:17 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:3:20: 3:21 + _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:3:20: 3:21 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:3:5: 3:34 } diff --git a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff index 1f5738ae75837..8395b22b8e2e7 100644 --- a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff @@ -6,19 +6,21 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:7:21: 7:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:8:8: 8:17 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:8:16: 8:17 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 -- _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 + StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 + StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:8:16: 8:17 + _3 = _1; // scope 1 at $DIR/bool_compare.rs:8:16: 8:17 +- _2 = Ne(const true, move _3); // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 ++ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 + StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:8:16: 8:17 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:8:20: 8:21 + _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:8:20: 8:21 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:8:5: 8:34 } diff --git a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff index 3320509a7b37a..413b5fdf20850 100644 --- a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff @@ -6,19 +6,21 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:12:21: 12:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:13:8: 13:18 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:13:8: 13:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:9 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:13:8: 13:9 -- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:13:17: 13:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 + StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 + StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:13:8: 13:9 + _3 = _1; // scope 1 at $DIR/bool_compare.rs:13:8: 13:9 +- _2 = Eq(move _3, const false); // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 ++ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 + StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:13:17: 13:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:13:21: 13:22 + _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:13:21: 13:22 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:13:5: 13:35 } diff --git a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff index 02049f4126da5..ba4496aa2c9f4 100644 --- a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff @@ -6,19 +6,21 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:17:21: 17:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:18:8: 18:18 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:18:17: 18:18 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 -- _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 + StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 + StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:18:17: 18:18 + _3 = _1; // scope 1 at $DIR/bool_compare.rs:18:17: 18:18 +- _2 = Eq(const false, move _3); // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 ++ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 + StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:18:17: 18:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:18:21: 18:22 + _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:18:21: 18:22 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:18:5: 18:35 } diff --git a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff index 544d16a251a82..3173d09fddc13 100644 --- a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff +++ b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff @@ -7,33 +7,35 @@ - let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _3: isize; // in scope 0 at $DIR/const_goto.rs:12:22: 12:28 + let mut _2: isize; // in scope 0 at $DIR/const_goto.rs:12:22: 12:28 + scope 1 { + } bb0: { -- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- _3 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:12:17: 12:20 -- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _2 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:12:17: 12:20 -+ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- StorageLive(_2); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- _3 = discriminant(_1); // scope 1 at $DIR/const_goto.rs:12:17: 12:20 +- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ _2 = discriminant(_1); // scope 1 at $DIR/const_goto.rs:12:17: 12:20 ++ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { -- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- _2 = const false; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const 42_u64; // scope 0 at $DIR/const_goto.rs:12:53: 12:55 + goto -> bb3; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 } bb2: { -- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- _2 = const true; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb4: { - _0 = const 23_u64; // scope 0 at $DIR/const_goto.rs:12:41: 12:43 + _0 = const 23_u64; // scope 1 at $DIR/const_goto.rs:12:41: 12:43 - goto -> bb6; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 + goto -> bb3; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 } diff --git a/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff index 62a681e1c12a7..33925e41faa62 100644 --- a/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff +++ b/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff @@ -13,54 +13,60 @@ scope 1 { debug val => _1; // in scope 1 at $DIR/const_goto_storage.rs:3:9: 3:12 } + scope 2 { + scope 3 { + scope 4 { + } + } + } bb0: { StorageLive(_1); // scope 0 at $DIR/const_goto_storage.rs:3:9: 3:12 - StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:3:21: 3:23 - nop; // scope 0 at $DIR/const_goto_storage.rs:3:21: 3:23 - StorageLive(_3); // scope 0 at $DIR/const_goto_storage.rs:4:15: 8:10 -- StorageLive(_4); // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 -- StorageLive(_5); // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 -- StorageLive(_6); // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 -- _6 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 -+ StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 -+ _2 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 -+ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 +- StorageLive(_4); // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 +- StorageLive(_5); // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 +- StorageLive(_6); // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 +- _6 = const true; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 +- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 ++ StorageLive(_2); // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 ++ _2 = const true; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 ++ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 } bb1: { -- _5 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:31: 4:35 -- goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 +- _5 = const true; // scope 4 at $DIR/const_goto_storage.rs:4:31: 4:35 +- goto -> bb3; // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 - } - - bb2: { -- _5 = const false; // scope 0 at $DIR/const_goto_storage.rs:4:45: 4:50 -- goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 +- _5 = const false; // scope 3 at $DIR/const_goto_storage.rs:4:45: 4:50 +- goto -> bb3; // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 - } - - bb3: { -- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:4:51: 4:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 +- StorageDead(_6); // scope 3 at $DIR/const_goto_storage.rs:4:51: 4:52 +- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 - } - - bb4: { -- _4 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:55: 4:59 -- goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 +- _4 = const true; // scope 3 at $DIR/const_goto_storage.rs:4:55: 4:59 +- goto -> bb6; // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 - } - - bb5: { -- _4 = const false; // scope 0 at $DIR/const_goto_storage.rs:4:69: 4:74 -- goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 +- _4 = const false; // scope 2 at $DIR/const_goto_storage.rs:4:69: 4:74 +- goto -> bb6; // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 - } - - bb6: { -- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:4:75: 4:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 +- StorageDead(_5); // scope 2 at $DIR/const_goto_storage.rs:4:75: 4:76 +- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 - } - - bb7: { -- _3 = const true; // scope 0 at $DIR/const_goto_storage.rs:5:13: 5:17 +- _3 = const true; // scope 2 at $DIR/const_goto_storage.rs:5:13: 5:17 - goto -> bb9; // scope 0 at $DIR/const_goto_storage.rs:4:15: 8:10 - } - @@ -76,7 +82,7 @@ - bb10: { - StorageDead(_4); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 - StorageDead(_3); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 -+ StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:4:51: 4:52 ++ StorageDead(_2); // scope 3 at $DIR/const_goto_storage.rs:4:51: 4:52 _1 = const true; // scope 0 at $DIR/const_goto_storage.rs:10:17: 10:21 - goto -> bb12; // scope 0 at $DIR/const_goto_storage.rs:10:17: 10:21 + goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:10:17: 10:21 @@ -86,7 +92,7 @@ - StorageDead(_4); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 - StorageDead(_3); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 + bb2: { -+ StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:4:51: 4:52 ++ StorageDead(_2); // scope 3 at $DIR/const_goto_storage.rs:4:51: 4:52 _1 = const false; // scope 0 at $DIR/const_goto_storage.rs:12:14: 12:19 - goto -> bb12; // scope 0 at $DIR/const_goto_storage.rs:12:14: 12:19 + goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:12:14: 12:19 diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index d7636c817099a..3d9517fb504c3 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -5,18 +5,20 @@ let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14 let mut _1: bool; // in scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + scope 1 { + } bb0: { - StorageLive(_1); // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 -- _1 = const ::NEEDS; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 -- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 -+ _1 = const false; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 -+ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 + StorageLive(_1); // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 +- _1 = const ::NEEDS; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 +- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 ++ _1 = const false; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 ++ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 } bb1: { - StorageLive(_2); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL - _2 = begin_panic::<&str>(const "explicit panic"); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + StorageLive(_2); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL + _2 = begin_panic::<&str>(const "explicit panic"); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL // mir::Constant // + span: $SRC_DIR/std/src/panic.rs:LL:COL // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir b/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir index 30512d0bbe874..4b11e4ebec6ac 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir @@ -2,6 +2,8 @@ fn hello() -> () { let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14 + scope 1 { + } bb0: { return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index a773ca246dd61..047853696f228 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -31,7 +31,7 @@ } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff index 6037f89086dc1..9f2ae1c90cad3 100644 --- a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff +++ b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff @@ -8,7 +8,6 @@ let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:9:46: 9:46 let mut _4: (); // in scope 0 at $DIR/cycle.rs:9:1: 18:2 let mut _5: bool; // in scope 0 at $DIR/cycle.rs:12:11: 12:17 - let _6: i32; // in scope 0 at $DIR/cycle.rs:13:13: 13:17 let mut _7: i32; // in scope 0 at $DIR/cycle.rs:14:13: 14:14 let mut _8: i32; // in scope 0 at $DIR/cycle.rs:15:13: 15:14 let mut _9: i32; // in scope 0 at $DIR/cycle.rs:16:13: 16:17 @@ -16,7 +15,10 @@ let _11: (); // in scope 0 at $DIR/cycle.rs:12:5: 17:6 let mut _12: !; // in scope 0 at $DIR/cycle.rs:12:5: 17:6 scope 1 { - debug temp => _6; // in scope 1 at $DIR/cycle.rs:13:13: 13:17 + let _6: i32; // in scope 1 at $DIR/cycle.rs:13:13: 13:17 + scope 2 { + debug temp => _6; // in scope 2 at $DIR/cycle.rs:13:13: 13:17 + } } bb0: { @@ -24,42 +26,42 @@ } bb1: { - StorageLive(_5); // scope 0 at $DIR/cycle.rs:12:11: 12:17 - _5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:12:11: 12:17 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:12:11: 12:17 + _5 = cond() -> bb2; // scope 1 at $DIR/cycle.rs:12:11: 12:17 // mir::Constant // + span: $DIR/cycle.rs:12:11: 12:15 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } } bb2: { - switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:12:11: 12:17 + switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/cycle.rs:12:11: 12:17 } bb3: { - StorageLive(_6); // scope 0 at $DIR/cycle.rs:13:13: 13:17 -- _6 = _3; // scope 0 at $DIR/cycle.rs:13:20: 13:21 -+ nop; // scope 0 at $DIR/cycle.rs:13:20: 13:21 - StorageLive(_7); // scope 1 at $DIR/cycle.rs:14:13: 14:14 -- _7 = _2; // scope 1 at $DIR/cycle.rs:14:13: 14:14 -- _3 = move _7; // scope 1 at $DIR/cycle.rs:14:9: 14:14 -+ nop; // scope 1 at $DIR/cycle.rs:14:13: 14:14 -+ nop; // scope 1 at $DIR/cycle.rs:14:9: 14:14 - StorageDead(_7); // scope 1 at $DIR/cycle.rs:14:13: 14:14 - StorageLive(_8); // scope 1 at $DIR/cycle.rs:15:13: 15:14 -- _8 = _1; // scope 1 at $DIR/cycle.rs:15:13: 15:14 -- _2 = move _8; // scope 1 at $DIR/cycle.rs:15:9: 15:14 -+ nop; // scope 1 at $DIR/cycle.rs:15:13: 15:14 -+ nop; // scope 1 at $DIR/cycle.rs:15:9: 15:14 - StorageDead(_8); // scope 1 at $DIR/cycle.rs:15:13: 15:14 - StorageLive(_9); // scope 1 at $DIR/cycle.rs:16:13: 16:17 -- _9 = _6; // scope 1 at $DIR/cycle.rs:16:13: 16:17 -- _1 = move _9; // scope 1 at $DIR/cycle.rs:16:9: 16:17 -+ nop; // scope 1 at $DIR/cycle.rs:16:13: 16:17 -+ nop; // scope 1 at $DIR/cycle.rs:16:9: 16:17 - StorageDead(_9); // scope 1 at $DIR/cycle.rs:16:16: 16:17 -- _4 = const (); // scope 0 at $DIR/cycle.rs:12:18: 17:6 -+ nop; // scope 0 at $DIR/cycle.rs:12:18: 17:6 - StorageDead(_6); // scope 0 at $DIR/cycle.rs:17:5: 17:6 + StorageLive(_6); // scope 1 at $DIR/cycle.rs:13:13: 13:17 +- _6 = _3; // scope 1 at $DIR/cycle.rs:13:20: 13:21 ++ nop; // scope 1 at $DIR/cycle.rs:13:20: 13:21 + StorageLive(_7); // scope 2 at $DIR/cycle.rs:14:13: 14:14 +- _7 = _2; // scope 2 at $DIR/cycle.rs:14:13: 14:14 +- _3 = move _7; // scope 2 at $DIR/cycle.rs:14:9: 14:14 ++ nop; // scope 2 at $DIR/cycle.rs:14:13: 14:14 ++ nop; // scope 2 at $DIR/cycle.rs:14:9: 14:14 + StorageDead(_7); // scope 2 at $DIR/cycle.rs:14:13: 14:14 + StorageLive(_8); // scope 2 at $DIR/cycle.rs:15:13: 15:14 +- _8 = _1; // scope 2 at $DIR/cycle.rs:15:13: 15:14 +- _2 = move _8; // scope 2 at $DIR/cycle.rs:15:9: 15:14 ++ nop; // scope 2 at $DIR/cycle.rs:15:13: 15:14 ++ nop; // scope 2 at $DIR/cycle.rs:15:9: 15:14 + StorageDead(_8); // scope 2 at $DIR/cycle.rs:15:13: 15:14 + StorageLive(_9); // scope 2 at $DIR/cycle.rs:16:13: 16:17 +- _9 = _6; // scope 2 at $DIR/cycle.rs:16:13: 16:17 +- _1 = move _9; // scope 2 at $DIR/cycle.rs:16:9: 16:17 ++ nop; // scope 2 at $DIR/cycle.rs:16:13: 16:17 ++ nop; // scope 2 at $DIR/cycle.rs:16:9: 16:17 + StorageDead(_9); // scope 2 at $DIR/cycle.rs:16:16: 16:17 +- _4 = const (); // scope 1 at $DIR/cycle.rs:12:18: 17:6 ++ nop; // scope 1 at $DIR/cycle.rs:12:18: 17:6 + StorageDead(_6); // scope 1 at $DIR/cycle.rs:17:5: 17:6 StorageDead(_5); // scope 0 at $DIR/cycle.rs:17:5: 17:6 goto -> bb1; // scope 0 at $DIR/cycle.rs:12:5: 17:6 } diff --git a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff index 5cfcef849e9db..089f43b5169f4 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff +++ b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff @@ -8,21 +8,23 @@ let mut _3: bool; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 let mut _4: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 let mut _5: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17 + scope 1 { + } bb0: { - StorageLive(_3); // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 - _3 = _1; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 - switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 + StorageLive(_3); // scope 1 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 + _3 = _1; // scope 1 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 + switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 } bb1: { - StorageLive(_4); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 - _4 = _2; // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 -- _0 = Foo::A(move _4); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 -+ Deinit(_0); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 -+ ((_0 as A).0: i32) = move _4; // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 -+ discriminant(_0) = 0; // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 - StorageDead(_4); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18 + StorageLive(_4); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 + _4 = _2; // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 +- _0 = Foo::A(move _4); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 ++ Deinit(_0); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 ++ ((_0 as A).0: i32) = move _4; // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 ++ discriminant(_0) = 0; // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 + StorageDead(_4); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18 goto -> bb3; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6 } diff --git a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff index c3aa19e6c5f84..e33057e81fa1e 100644 --- a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff @@ -12,6 +12,8 @@ scope 2 { debug y => _2; // in scope 2 at $DIR/branch.rs:15:9: 15:10 } + scope 3 { + } } bb0: { @@ -24,19 +26,19 @@ bb1: { StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10 - StorageLive(_3); // scope 1 at $DIR/branch.rs:15:16: 15:22 - _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22 + StorageLive(_3); // scope 3 at $DIR/branch.rs:15:16: 15:22 + _3 = cond() -> bb2; // scope 3 at $DIR/branch.rs:15:16: 15:22 // mir::Constant // + span: $DIR/branch.rs:15:16: 15:20 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } } bb2: { - switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:15:16: 15:22 + switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 3 at $DIR/branch.rs:15:16: 15:22 } bb3: { - nop; // scope 1 at $DIR/branch.rs:16:9: 16:10 + nop; // scope 3 at $DIR/branch.rs:16:9: 16:10 goto -> bb6; // scope 1 at $DIR/branch.rs:15:13: 20:6 } diff --git a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff index d77056e6316f2..982dd7a27bc6b 100644 --- a/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff +++ b/src/test/mir-opt/early_otherwise_branch_soundness.no_downcast.EarlyOtherwiseBranch.diff @@ -24,7 +24,7 @@ } bb2: { - _0 = const 1_u32; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 + _0 = const 1_u32; // scope 1 at $DIR/early_otherwise_branch_soundness.rs:13:38: 13:39 goto -> bb4; // scope 0 at $DIR/early_otherwise_branch_soundness.rs:13:5: 13:52 } diff --git a/src/test/mir-opt/equal_true.opt.InstCombine.diff b/src/test/mir-opt/equal_true.opt.InstCombine.diff index 174095888b48a..56f2fede4377b 100644 --- a/src/test/mir-opt/equal_true.opt.InstCombine.diff +++ b/src/test/mir-opt/equal_true.opt.InstCombine.diff @@ -6,19 +6,21 @@ let mut _0: i32; // return place in scope 0 at $DIR/equal_true.rs:3:20: 3:23 let mut _2: bool; // in scope 0 at $DIR/equal_true.rs:4:8: 4:17 let mut _3: bool; // in scope 0 at $DIR/equal_true.rs:4:8: 4:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/equal_true.rs:4:8: 4:17 - StorageLive(_3); // scope 0 at $DIR/equal_true.rs:4:8: 4:9 - _3 = _1; // scope 0 at $DIR/equal_true.rs:4:8: 4:9 -- _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:4:8: 4:17 -+ _2 = move _3; // scope 0 at $DIR/equal_true.rs:4:8: 4:17 - StorageDead(_3); // scope 0 at $DIR/equal_true.rs:4:16: 4:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:4:8: 4:17 + StorageLive(_2); // scope 1 at $DIR/equal_true.rs:4:8: 4:17 + StorageLive(_3); // scope 1 at $DIR/equal_true.rs:4:8: 4:9 + _3 = _1; // scope 1 at $DIR/equal_true.rs:4:8: 4:9 +- _2 = Eq(move _3, const true); // scope 1 at $DIR/equal_true.rs:4:8: 4:17 ++ _2 = move _3; // scope 1 at $DIR/equal_true.rs:4:8: 4:17 + StorageDead(_3); // scope 1 at $DIR/equal_true.rs:4:16: 4:17 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/equal_true.rs:4:8: 4:17 } bb1: { - _0 = const 0_i32; // scope 0 at $DIR/equal_true.rs:4:20: 4:21 + _0 = const 0_i32; // scope 1 at $DIR/equal_true.rs:4:20: 4:21 goto -> bb3; // scope 0 at $DIR/equal_true.rs:4:5: 4:34 } 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 index 2e0df0a6ba9f7..15409fa0dd23c 100644 --- 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 @@ -81,34 +81,34 @@ bb6: { StorageLive(_10); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 _10 = ((_7 as Some).0: usize); // scope 3 at $DIR/funky_arms.rs:24:17: 24:26 - StorageLive(_11); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - _11 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 - StorageLive(_12); // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - _12 = _2; // scope 2 at $DIR/funky_arms.rs:26:48: 26:51 - StorageLive(_13); // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - _13 = _6; // scope 2 at $DIR/funky_arms.rs:26:53: 26:57 - StorageLive(_14); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageLive(_15); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageLive(_16); // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _16 = _10; // scope 2 at $DIR/funky_arms.rs:26:59: 26:68 - _15 = move _16 as u32 (Misc); // scope 2 at $DIR/funky_arms.rs:26:59: 26:75 - StorageDead(_16); // scope 2 at $DIR/funky_arms.rs:26:74: 26:75 - _14 = Add(move _15, const 1_u32); // scope 2 at $DIR/funky_arms.rs:26:59: 26:79 - StorageDead(_15); // scope 2 at $DIR/funky_arms.rs:26:78: 26:79 - StorageLive(_17); // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _17 = _3; // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _0 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 2 at $DIR/funky_arms.rs:26:9: 26:87 + 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 + 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 = float_to_exponential_common_exact::(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 3 at $DIR/funky_arms.rs:26:9: 26:87 // mir::Constant // + span: $DIR/funky_arms.rs:26:9: 26:42 // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut Formatter<'s>, &'t0 T, Sign, u32, bool) -> Result<(), std::fmt::Error> {float_to_exponential_common_exact::}, val: Value(Scalar()) } } bb7: { - StorageDead(_17); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_14); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_13); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_12); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 - StorageDead(_11); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 + 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 } diff --git a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff index dddb7acae2b2c..1baa7c7677a06 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff @@ -5,15 +5,17 @@ debug x => _1; // in scope 0 at $DIR/if-condition-int.rs:16:18: 16:19 let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:16:30: 16:33 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 - _2 = _1; // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:17:8: 17:9 + _2 = _1; // scope 1 at $DIR/if-condition-int.rs:17:8: 17:9 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:17:8: 17:9 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:17:12: 17:13 + _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:17:12: 17:13 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:17:5: 17:26 } diff --git a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index 2ff8386b205bd..13933ea52f707 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -6,18 +6,20 @@ let mut _0: i32; // return place in scope 0 at $DIR/if-condition-int.rs:52:31: 52:34 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 let mut _3: f32; // in scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 - StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 - _3 = _1; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 - _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 - StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:53:17: 53:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:53:8: 53:18 + StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:53:8: 53:9 + _3 = _1; // scope 1 at $DIR/if-condition-int.rs:53:8: 53:9 + _2 = Eq(move _3, const -42f32); // scope 1 at $DIR/if-condition-int.rs:53:8: 53:18 + StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:53:17: 53:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:53:8: 53:18 } bb1: { - _0 = const 0_i32; // scope 0 at $DIR/if-condition-int.rs:53:21: 53:22 + _0 = const 0_i32; // scope 1 at $DIR/if-condition-int.rs:53:21: 53:22 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:53:5: 53:35 } diff --git a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff index 40de48385f02e..543818fdda0e6 100644 --- a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff @@ -6,27 +6,29 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:20:25: 20:28 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 let mut _3: char; // in scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 - StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 - _3 = _1; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 -- _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 -- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:15: 21:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 -+ nop; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 -+ nop; // scope 0 at $DIR/if-condition-int.rs:21:15: 21:16 -+ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 + StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:9 + _3 = _1; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:9 +- _2 = Eq(move _3, const 'x'); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 +- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:21:15: 21:16 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 ++ nop; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 ++ nop; // scope 1 at $DIR/if-condition-int.rs:21:15: 21:16 ++ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 - _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:21:19: 21:20 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 + _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:21:19: 21:20 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:21:30: 21:31 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 } diff --git a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff index 28c36aed84c38..92e770c15e53c 100644 --- a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff @@ -6,27 +6,29 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:24:21: 24:24 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 let mut _3: i8; // in scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 - StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 - _3 = _1; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 -- _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 -- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:14: 25:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 -+ nop; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 -+ nop; // scope 0 at $DIR/if-condition-int.rs:25:14: 25:15 -+ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 + StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:9 + _3 = _1; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:9 +- _2 = Eq(move _3, const 42_i8); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 +- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:25:14: 25:15 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 ++ nop; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 ++ nop; // scope 1 at $DIR/if-condition-int.rs:25:14: 25:15 ++ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 - _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:25:18: 25:19 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 + _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:25:18: 25:19 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:25:29: 25:30 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 } diff --git a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff index 55932fee9600c..6a3d8a948be16 100644 --- a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff @@ -8,46 +8,50 @@ let mut _3: u32; // in scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 let mut _4: bool; // in scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 let mut _5: u32; // in scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 + scope 1 { + } + scope 2 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 - StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 - _3 = _1; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 -- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 -- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:14: 33:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 -+ nop; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 -+ nop; // scope 0 at $DIR/if-condition-int.rs:33:14: 33:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 + StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:9 + _3 = _1; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:9 +- _2 = Eq(move _3, const 42_u32); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 +- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:33:14: 33:15 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 ++ nop; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 ++ nop; // scope 1 at $DIR/if-condition-int.rs:33:14: 33:15 ++ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 - _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:34:9: 34:10 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 + _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:34:9: 34:10 goto -> bb6; // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 - StorageLive(_4); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 - StorageLive(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 - _5 = _1; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 -- _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 -- StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:21: 35:22 -- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 -+ nop; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 -+ nop; // scope 0 at $DIR/if-condition-int.rs:35:21: 35:22 -+ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 + StorageLive(_4); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 + StorageLive(_5); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:16 + _5 = _1; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:16 +- _4 = Ne(move _5, const 21_u32); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 +- StorageDead(_5); // scope 2 at $DIR/if-condition-int.rs:35:21: 35:22 +- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 ++ nop; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 ++ nop; // scope 2 at $DIR/if-condition-int.rs:35:21: 35:22 ++ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 } bb3: { -+ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 - _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:36:9: 36:10 ++ StorageDead(_5); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 + _0 = const 1_u32; // scope 2 at $DIR/if-condition-int.rs:36:9: 36:10 goto -> bb5; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 } bb4: { -+ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 ++ StorageDead(_5); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 _0 = const 2_u32; // scope 0 at $DIR/if-condition-int.rs:38:9: 38:10 goto -> bb5; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 } diff --git a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff index c4574b32a5999..fa2ef0c1ec5b3 100644 --- a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff @@ -6,27 +6,29 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:28:28: 28:31 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 let mut _3: i32; // in scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 - StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 - _3 = _1; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 -- _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 -- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:15: 29:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 -+ nop; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 -+ nop; // scope 0 at $DIR/if-condition-int.rs:29:15: 29:16 -+ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 + StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:9 + _3 = _1; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:9 +- _2 = Eq(move _3, const -42_i32); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 +- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:29:15: 29:16 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 ++ nop; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 ++ nop; // scope 1 at $DIR/if-condition-int.rs:29:15: 29:16 ++ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 - _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:29:19: 29:20 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 + _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:29:19: 29:20 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:29:30: 29:31 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 } diff --git a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff index 88d9d5622b8ec..9549e198060c4 100644 --- a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff @@ -6,27 +6,29 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:11:23: 11:26 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 let mut _3: u32; // in scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 - StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 - _3 = _1; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 -- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 -- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:14: 12:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 -+ nop; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 -+ nop; // scope 0 at $DIR/if-condition-int.rs:12:14: 12:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 + StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 + StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:9 + _3 = _1; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:9 +- _2 = Eq(move _3, const 42_u32); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 +- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:12:14: 12:15 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 ++ nop; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 ++ nop; // scope 1 at $DIR/if-condition-int.rs:12:14: 12:15 ++ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 - _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:12:18: 12:19 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 + _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:12:18: 12:19 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 ++ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:12:29: 12:30 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 } diff --git a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff index da55260e284ea..9a00bb809c6c1 100644 --- a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff @@ -9,24 +9,26 @@ let mut _4: i32; // in scope 0 at $DIR/inline-diverging.rs:14:9: 14:10 let mut _5: !; // in scope 0 at $DIR/inline-diverging.rs:15:12: 17:6 let _6: !; // in scope 0 at $DIR/inline-diverging.rs:16:9: 16:16 -+ scope 1 (inlined panic) { // at $DIR/inline-diverging.rs:16:9: 16:16 -+ let mut _7: !; // in scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL + scope 1 { + } ++ scope 2 (inlined panic) { // at $DIR/inline-diverging.rs:16:9: 16:16 ++ let mut _7: !; // in scope 2 at $SRC_DIR/std/src/panic.rs:LL:COL + } bb0: { - StorageLive(_2); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 - StorageLive(_3); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:9 - _3 = _1; // scope 0 at $DIR/inline-diverging.rs:13:8: 13:9 - _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 - StorageDead(_3); // scope 0 at $DIR/inline-diverging.rs:13:12: 13:13 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 + StorageLive(_2); // scope 1 at $DIR/inline-diverging.rs:13:8: 13:13 + StorageLive(_3); // scope 1 at $DIR/inline-diverging.rs:13:8: 13:9 + _3 = _1; // scope 1 at $DIR/inline-diverging.rs:13:8: 13:9 + _2 = Gt(move _3, const 0_i32); // scope 1 at $DIR/inline-diverging.rs:13:8: 13:13 + StorageDead(_3); // scope 1 at $DIR/inline-diverging.rs:13:12: 13:13 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/inline-diverging.rs:13:8: 13:13 } bb1: { - StorageLive(_4); // scope 0 at $DIR/inline-diverging.rs:14:9: 14:10 - _4 = _1; // scope 0 at $DIR/inline-diverging.rs:14:9: 14:10 - _0 = move _4 as u32 (Misc); // scope 0 at $DIR/inline-diverging.rs:14:9: 14:17 - StorageDead(_4); // scope 0 at $DIR/inline-diverging.rs:14:16: 14:17 + StorageLive(_4); // scope 1 at $DIR/inline-diverging.rs:14:9: 14:10 + _4 = _1; // scope 1 at $DIR/inline-diverging.rs:14:9: 14:10 + _0 = move _4 as u32 (Misc); // scope 1 at $DIR/inline-diverging.rs:14:9: 14:17 + StorageDead(_4); // scope 1 at $DIR/inline-diverging.rs:14:16: 14:17 StorageDead(_2); // scope 0 at $DIR/inline-diverging.rs:17:5: 17:6 return; // scope 0 at $DIR/inline-diverging.rs:18:2: 18:2 } @@ -34,8 +36,8 @@ bb2: { StorageLive(_6); // scope 0 at $DIR/inline-diverging.rs:16:9: 16:16 - _6 = panic(); // scope 0 at $DIR/inline-diverging.rs:16:9: 16:16 -+ StorageLive(_7); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL -+ _7 = begin_panic::<&str>(const "explicit panic"); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL ++ StorageLive(_7); // scope 2 at $SRC_DIR/std/src/panic.rs:LL:COL ++ _7 = begin_panic::<&str>(const "explicit panic"); // scope 2 at $SRC_DIR/std/src/panic.rs:LL:COL // mir::Constant - // + span: $DIR/inline-diverging.rs:16:9: 16:14 - // + literal: Const { ty: fn() -> ! {panic}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/inline/inline_generator.main.Inline.diff b/src/test/mir-opt/inline/inline_generator.main.Inline.diff index 3e1c4a4670143..af32b31580257 100644 --- a/src/test/mir-opt/inline/inline_generator.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_generator.main.Inline.diff @@ -33,6 +33,8 @@ + let mut _13: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41 + let mut _14: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41 + let mut _15: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41 ++ scope 7 { ++ } + } bb0: { @@ -104,13 +106,13 @@ + bb3: { + _11 = move _7; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41 + StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:15:17: 15:39 -+ StorageLive(_9); // scope 6 at $DIR/inline-generator.rs:15:20: 15:21 -+ _9 = _11; // scope 6 at $DIR/inline-generator.rs:15:20: 15:21 -+ switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline-generator.rs:15:20: 15:21 ++ StorageLive(_9); // scope 7 at $DIR/inline-generator.rs:15:20: 15:21 ++ _9 = _11; // scope 7 at $DIR/inline-generator.rs:15:20: 15:21 ++ switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 7 at $DIR/inline-generator.rs:15:20: 15:21 + } + + bb4: { -+ _8 = const 7_i32; // scope 6 at $DIR/inline-generator.rs:15:24: 15:25 ++ _8 = const 7_i32; // scope 7 at $DIR/inline-generator.rs:15:24: 15:25 + goto -> bb6; // scope 6 at $DIR/inline-generator.rs:15:17: 15:39 + } + diff --git a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index a2471e4308b01..d4fe82cc99f67 100644 --- a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -9,6 +9,8 @@ fn main() -> () { let mut _5: !; // in scope 0 at $DIR/issue-38669.rs:7:25: 9:10 scope 1 { debug should_break => _1; // in scope 1 at $DIR/issue-38669.rs:5:9: 5:25 + scope 2 { + } } bb0: { @@ -24,13 +26,13 @@ fn main() -> () { bb2: { StorageLive(_3); // scope 1 at $DIR/issue-38669.rs:7:9: 9:10 - StorageLive(_4); // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 - _4 = _1; // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 - switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 + StorageLive(_4); // scope 2 at $DIR/issue-38669.rs:7:12: 7:24 + _4 = _1; // scope 2 at $DIR/issue-38669.rs:7:12: 7:24 + switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/issue-38669.rs:7:12: 7:24 } bb3: { - _0 = const (); // scope 1 at $DIR/issue-38669.rs:8:13: 8:18 + _0 = const (); // scope 2 at $DIR/issue-38669.rs:8:13: 8:18 StorageDead(_4); // scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_3); // scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_1); // scope 0 at $DIR/issue-38669.rs:12:1: 12:2 diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 3c662a8681406..7930aa9976864 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -15,8 +15,10 @@ fn main() -> () { scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 scope 2 { - debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 - let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + scope 3 { + debug _k => _6; // in scope 3 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 3 at $DIR/issue-41888.rs:10:21: 10:23 + } } } @@ -25,48 +27,48 @@ fn main() -> () { _7 = const false; // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 _8 = const false; // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 StorageLive(_1); // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 - StorageLive(_2); // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 - _2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 + StorageLive(_2); // scope 2 at $DIR/issue-41888.rs:8:8: 8:14 + _2 = cond() -> [return: bb1, unwind: bb11]; // scope 2 at $DIR/issue-41888.rs:8:8: 8:14 // mir::Constant // + span: $DIR/issue-41888.rs:8:8: 8:12 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } } bb1: { - switchInt(move _2) -> [false: bb7, otherwise: bb2]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 + switchInt(move _2) -> [false: bb7, otherwise: bb2]; // scope 2 at $DIR/issue-41888.rs:8:8: 8:14 } bb2: { - StorageLive(_3); // scope 1 at $DIR/issue-41888.rs:9:13: 9:20 - StorageLive(_4); // scope 1 at $DIR/issue-41888.rs:9:18: 9:19 - _4 = K; // scope 1 at $DIR/issue-41888.rs:9:18: 9:19 - _3 = E::F(move _4); // scope 1 at $DIR/issue-41888.rs:9:13: 9:20 - StorageDead(_4); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - goto -> bb14; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + StorageLive(_3); // scope 2 at $DIR/issue-41888.rs:9:13: 9:20 + StorageLive(_4); // scope 2 at $DIR/issue-41888.rs:9:18: 9:19 + _4 = K; // scope 2 at $DIR/issue-41888.rs:9:18: 9:19 + _3 = E::F(move _4); // scope 2 at $DIR/issue-41888.rs:9:13: 9:20 + StorageDead(_4); // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 + goto -> bb14; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 } bb3: { - goto -> bb4; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + goto -> bb4; // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 } bb4: { - StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + StorageDead(_3); // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 + _5 = discriminant(_1); // scope 3 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 3 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageLive(_6); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 - StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 - goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 + StorageLive(_6); // scope 3 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 3 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 3 at $DIR/issue-41888.rs:10:21: 10:23 + _0 = const (); // scope 3 at $DIR/issue-41888.rs:10:29: 13:10 + StorageDead(_6); // scope 2 at $DIR/issue-41888.rs:13:9: 13:10 + goto -> bb8; // scope 2 at $DIR/issue-41888.rs:10:9: 13:10 } bb6: { - _0 = const (); // scope 1 at $DIR/issue-41888.rs:13:10: 13:10 - goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 + _0 = const (); // scope 2 at $DIR/issue-41888.rs:13:10: 13:10 + goto -> bb8; // scope 2 at $DIR/issue-41888.rs:10:9: 13:10 } bb7: { @@ -88,7 +90,7 @@ fn main() -> () { } bb10 (cleanup): { - goto -> bb11; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + goto -> bb11; // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 } bb11 (cleanup): { @@ -100,19 +102,19 @@ fn main() -> () { } bb13 (cleanup): { - _7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - _8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - _9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - _1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - goto -> bb10; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _7 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _8 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _9 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _1 = move _3; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb10; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 } bb14: { - _7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - _8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - _9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - _1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - goto -> bb3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _7 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _8 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _9 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _1 = move _3; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb3; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 } bb15: { diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 8b0a73ec4ba61..52a4cc661a52d 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -29,9 +29,11 @@ scope 4 { debug left_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _13: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug kind => _13; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _13: core::panicking::AssertKind; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 { + debug kind => _13; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -70,32 +72,32 @@ _8 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _9 = (_5.1: &i32); // scope 3 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 - 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 - _11 = Eq(move _12, const 1_i32); // 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 = Not(move _11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _10) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_11); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = (*_8); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = Eq(move _12, const 1_i32); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = Not(move _11); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _10) -> [false: bb2, otherwise: bb1]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = _8; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = _16; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_19) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _14 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = _8; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = _16; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = _9; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _18; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_19); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_19); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_19) = 0; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _14 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index c96a6641bab91..877c03d65cf9f 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -37,9 +37,11 @@ scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _20: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug kind => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: core::panicking::AssertKind; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 6 { + debug kind => _20; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -97,42 +99,42 @@ _13 = (_9.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _14 = (_9.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - 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 = const 1_i32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = Eq(move _17, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - 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 - StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _15) -> [false: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = (*_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = const 1_i32; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = Eq(move _17, const 1_i32); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = Not(move _16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _15) -> [false: bb4, otherwise: bb3]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { - StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_20) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = const core::panicking::AssertKind::Eq; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_20) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = const core::panicking::AssertKind::Eq; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } - StorageLive(_23); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _13; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _24; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _26 = _14; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = _26; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_27) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = _13; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = _24; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _14; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_27); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_27) = 0; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 40e7b74453a7c..1dca68fd72790 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -8,60 +8,62 @@ fn num_to_digit(_1: char) -> u32 { let mut _4: char; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29 let mut _5: u32; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 let mut _12: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 - debug self => _2; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - debug radix => _5; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let mut _6: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let _7: std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let mut _8: char; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - scope 2 (inlined Option::::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL - debug self => _6; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _9: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + scope 1 { + scope 2 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 + debug self => _2; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug radix => _5; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let mut _6: &std::option::Option; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let _7: std::option::Option; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let mut _8: char; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + scope 3 (inlined Option::::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug self => _6; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _9: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + } } - } - scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 - debug self => _3; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _10: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _11: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - scope 4 { - debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + scope 4 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 + debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _10: isize; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _11: !; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + scope 5 { + debug val => _0; // in scope 5 at $SRC_DIR/core/src/option.rs:LL:COL + } } } bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 - _2 = _1; // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 - StorageLive(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_2); // scope 1 at $DIR/issue-59352.rs:14:8: 14:11 + _2 = _1; // scope 1 at $DIR/issue-59352.rs:14:8: 14:11 + StorageLive(_5); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_6); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_7); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_8); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _8 = _2; // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value(Scalar()) } } bb1: { - StorageDead(_12); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 - StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 - _4 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 - _3 = char::methods::::to_digit(move _4, const 8_u32) -> bb2; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 + StorageDead(_12); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_3); // scope 1 at $DIR/issue-59352.rs:14:26: 14:41 + StorageLive(_4); // scope 1 at $DIR/issue-59352.rs:14:26: 14:29 + _4 = _1; // scope 1 at $DIR/issue-59352.rs:14:26: 14:29 + _3 = char::methods::::to_digit(move _4, const 8_u32) -> bb2; // scope 1 at $DIR/issue-59352.rs:14:26: 14:41 // mir::Constant // + span: $DIR/issue-59352.rs:14:30: 14:38 // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value(Scalar()) } } bb2: { - StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 - StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - _10 = discriminant(_3); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_4); // scope 1 at $DIR/issue-59352.rs:14:40: 14:41 + StorageLive(_10); // scope 1 at $DIR/issue-59352.rs:14:26: 14:50 + _10 = discriminant(_3); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL } bb3: { - StorageDead(_12); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_12); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } @@ -71,23 +73,23 @@ fn num_to_digit(_1: char) -> u32 { } bb5: { - _6 = &_7; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_9); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _9 = discriminant((*_6)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL - StorageLive(_12); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = move _9; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_9); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:22: 14:23 - switchInt(move _12) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + _6 = &_7; // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_8); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_9); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _9 = discriminant((*_6)); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageLive(_12); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = move _9; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_6); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_7); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_5); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_2); // scope 1 at $DIR/issue-59352.rs:14:22: 14:23 + switchInt(move _12) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 } bb6: { - StorageLive(_11); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageLive(_11); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/option.rs:LL:COL // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } @@ -97,13 +99,13 @@ fn num_to_digit(_1: char) -> u32 { } bb7: { - unreachable; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + unreachable; // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL } bb8: { - _0 = move ((_3 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 + _0 = move ((_3 as Some).0: u32); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_10); // scope 1 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_3); // scope 1 at $DIR/issue-59352.rs:14:49: 14:50 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } } diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index a194cddd52a60..b8023a6a8e690 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -13,8 +13,8 @@ scope 3 { debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 let _4: u32; // in scope 3 at $DIR/issue-75439.rs:9:27: 9:29 - } - scope 4 { + scope 4 { + } } } scope 2 { @@ -44,7 +44,7 @@ } bb4: { - StorageLive(_5); // scope 1 at $DIR/issue-75439.rs:10:14: 10:38 + StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:10:14: 10:38 StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _6 = _4; // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _5 = transmute::(move _6) -> bb7; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36 @@ -67,10 +67,10 @@ bb7: { StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:10:35: 10:36 - Deinit(_0); // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - ((_0 as Some).0: [u8; 4]) = move _5; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - discriminant(_0) = 1; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 - StorageDead(_5); // scope 1 at $DIR/issue-75439.rs:10:38: 10:39 + Deinit(_0); // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + ((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:10:9: 10:39 + StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:10:38: 10:39 StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:11:5: 11:6 goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 } diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index 9e91603cee943..d39bb419e3ff5 100644 --- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -9,18 +9,20 @@ fn main() -> () { let mut _5: (); // in scope 0 at $DIR/loop_test.rs:6:1: 17:2 let _6: i32; // in scope 0 at $DIR/loop_test.rs:14:13: 14:14 scope 1 { - debug x => _6; // in scope 1 at $DIR/loop_test.rs:14:13: 14:14 + } + scope 2 { + debug x => _6; // in scope 2 at $DIR/loop_test.rs:14:13: 14:14 } bb0: { StorageLive(_1); // scope 0 at $DIR/loop_test.rs:10:5: 12:6 - StorageLive(_2); // scope 0 at $DIR/loop_test.rs:10:8: 10:12 - _2 = const true; // scope 0 at $DIR/loop_test.rs:10:8: 10:12 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:10:8: 10:12 + StorageLive(_2); // scope 1 at $DIR/loop_test.rs:10:8: 10:12 + _2 = const true; // scope 1 at $DIR/loop_test.rs:10:8: 10:12 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/loop_test.rs:10:8: 10:12 } bb1: { - _0 = const (); // scope 0 at $DIR/loop_test.rs:11:9: 11:15 + _0 = const (); // scope 1 at $DIR/loop_test.rs:11:9: 11:15 StorageDead(_2); // scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageDead(_1); // scope 0 at $DIR/loop_test.rs:12:5: 12:6 return; // scope 0 at $DIR/loop_test.rs:17:2: 17:2 diff --git a/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff b/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff index c7226573d75c5..e2cc076c6d8d1 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff @@ -13,43 +13,45 @@ let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + scope 1 { + let mut _11: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 - _4 = _1; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 - StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _7 = _2; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - _11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 -- _5 = Len((*_11)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 + _4 = _1; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _7 = _2; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + _11 = _7; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:7:20: 7:21 +- _5 = Len((*_11)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _5 = const N; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 } bb1: { - StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 - _8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 -- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -+ _9 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 + _8 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 +- _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 ++ _9 = const N; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 } bb2: { - _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 + _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 goto -> bb4; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff b/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff index d6c1c92cd9177..d1cd3865da327 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff @@ -13,45 +13,47 @@ let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -+ let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + scope 1 { ++ let mut _11: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 - _4 = _1; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 - StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -+ StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 -- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _5 = Len((*_11)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -+ StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 - goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 + _4 = _1; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 ++ StorageLive(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _11 = _7; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:7:20: 7:21 +- _5 = Len((*_6)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _5 = Len((*_11)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 ++ StorageDead(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + goto -> bb1; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 } bb1: { - StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 } bb2: { - StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 - _8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 - _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 + _8 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 + _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 } bb3: { - _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 + _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff index 887c7b01f4327..3d7047b71d342 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff @@ -13,47 +13,49 @@ - let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 - let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -- let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + let _6: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 + let mut _7: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + let mut _8: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + scope 1 { +- let mut _11: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 - _4 = _1; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 - StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 - _5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 + _4 = _1; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageLive(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:7:20: 7:21 + _5 = const N; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageDead(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 } bb1: { -- StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 -- _8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 -- _9 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -- _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -+ StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 -+ _6 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 -+ _7 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -+ _8 = Lt(_6, _7); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 +- StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 +- _8 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 +- _9 = const N; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 +- _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 ++ StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 ++ _6 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 ++ _7 = const N; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 ++ _8 = Lt(_6, _7); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 ++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 } bb2: { -- _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -- StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 -+ _0 = (*_2)[_6]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 -+ StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 +- _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 +- StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 ++ _0 = (*_2)[_6]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 ++ StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 goto -> bb4; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff index 5622d48453213..ef5641ad34335 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff @@ -16,42 +16,44 @@ let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 - let mut _14: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + scope 1 { + let mut _14: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 - _4 = _1; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 - StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - _14 = _7; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 -- _5 = Len((*_14)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -+ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 + _4 = _1; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + _14 = _7; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:18:20: 18:21 +- _5 = Len((*_14)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 ++ _5 = const N; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 } bb1: { - StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 - _8 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 -- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -+ _9 = const N; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 - _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 + _8 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 +- _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 ++ _9 = const N; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 } bb2: { - _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 - StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 + _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:18:5: 24:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff index 11fc20aa693c7..c31c9d80a1bf3 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff @@ -16,45 +16,47 @@ let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 -+ let mut _14: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + scope 1 { ++ let mut _14: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 - _4 = _1; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 - StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -+ StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -+ _14 = _7; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 -- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -+ _5 = Len((*_14)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -+ StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 - goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 + _4 = _1; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 ++ StorageLive(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 ++ _14 = _7; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:18:20: 18:21 +- _5 = Len((*_6)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 ++ _5 = Len((*_14)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 ++ StorageDead(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + goto -> bb1; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 } bb1: { - StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 } bb2: { - StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 - _8 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 - _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 - _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 + _8 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 + _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 } bb3: { - _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 - StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 + _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 goto -> bb6; // scope 0 at $DIR/lower_array_len.rs:18:5: 24:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff index 51d5f1acdab83..a3d794f94b3f2 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff @@ -16,50 +16,52 @@ - let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 - let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 - let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 -- let mut _14: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + let _6: usize; // in scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 + let mut _7: usize; // in scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + let mut _8: bool; // in scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + let _9: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 + let mut _10: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 + let mut _11: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 + scope 1 { +- let mut _14: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 - _4 = _1; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 - StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 - _5 = const N; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 + _4 = _1; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 + StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageLive(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:18:20: 18:21 + _5 = const N; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageDead(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 } bb1: { -- StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 -- _8 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 -- _9 = const N; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -- _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -+ StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 -+ _6 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 -+ _7 = const N; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -+ _8 = Lt(_6, _7); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 +- StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 +- _8 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 +- _9 = const N; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 +- _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 ++ StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 ++ _6 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 ++ _7 = const N; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 ++ _8 = Lt(_6, _7); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 ++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 } bb2: { -- _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -- StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 -+ _0 = (*_2)[_6]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 -+ StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 +- _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 +- StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 ++ _0 = (*_2)[_6]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 ++ StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:18:5: 24:6 } diff --git a/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir b/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir index 7750624db30fb..4b77db0707d3f 100644 --- a/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir +++ b/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir @@ -7,7 +7,9 @@ fn f_u64() -> () { debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:44:22: 44:23 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:48:9: 48:21 let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:48:19: 48:20 - scope 2 (inlined std::mem::size_of::) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 + scope 2 { + scope 3 (inlined std::mem::size_of::) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 + } } } diff --git a/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir b/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir index 4d4e65d311416..1306caf229174 100644 --- a/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir +++ b/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir @@ -6,21 +6,23 @@ fn f_unit() -> () { scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19 debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:44:22: 44:23 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:46:9: 46:17 - scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 + scope 2 { + scope 3 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 + } } } bb0: { StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18 - StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:46:9: 46:17 - _2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:46:9: 46:17 + StorageLive(_2); // scope 2 at $DIR/lower_intrinsics.rs:46:9: 46:17 + _2 = f_zst::<()>(const ()) -> bb1; // scope 2 at $DIR/lower_intrinsics.rs:46:9: 46:17 // mir::Constant // + span: $DIR/lower_intrinsics.rs:46:9: 46:14 // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(Scalar()) } } bb1: { - StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:46:17: 46:18 + StorageDead(_2); // scope 2 at $DIR/lower_intrinsics.rs:46:17: 46:18 StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:18: 34:19 return; // scope 0 at $DIR/lower_intrinsics.rs:35:2: 35:2 } diff --git a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff index 13241d882f210..095641a597ba8 100644 --- a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff +++ b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -12,41 +12,43 @@ let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + scope 1 { + } bb0: { - StorageLive(_3); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 - StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 - _4 = _1; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 - StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 - StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 - _6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 -- _5 = core::slice::::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 + StorageLive(_3); // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageLive(_4); // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:13 + _4 = _1; // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:13 + StorageLive(_5); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 + StorageLive(_6); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 + _6 = &(*_2); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 +- _5 = core::slice::::len(move _6) -> bb1; // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 - // mir::Constant - // + span: $DIR/lower_slice_len.rs:5:22: 5:25 - // + literal: Const { ty: for<'r> fn(&'r [u8]) -> usize {core::slice::::len}, val: Value(Scalar()) } -+ _5 = Len((*_6)); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 -+ goto -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 ++ _5 = Len((*_6)); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 ++ goto -> bb1; // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 } bb1: { - StorageDead(_6); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 - _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 - StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 - StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageDead(_6); // scope 1 at $DIR/lower_slice_len.rs:5:26: 5:27 + _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageDead(_5); // scope 1 at $DIR/lower_slice_len.rs:5:26: 5:27 + StorageDead(_4); // scope 1 at $DIR/lower_slice_len.rs:5:26: 5:27 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:27 } bb2: { - StorageLive(_7); // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 - _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 - _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 - _9 = Lt(_7, _8); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + StorageLive(_7); // scope 1 at $DIR/lower_slice_len.rs:6:15: 6:20 + _7 = _1; // scope 1 at $DIR/lower_slice_len.rs:6:15: 6:20 + _8 = Len((*_2)); // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 + _9 = Lt(_7, _8); // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 } bb3: { - _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 - StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:7:5: 7:6 + _0 = (*_2)[_7]; // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 + StorageDead(_7); // scope 1 at $DIR/lower_slice_len.rs:7:5: 7:6 goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 } diff --git a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff index c2e422f800250..72fd303d447d1 100644 --- a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -26,8 +26,12 @@ debug s => _8; // in scope 1 at $DIR/match-arm-scopes.rs:15:20: 15:21 } scope 2 { - debug b => _15; // in scope 2 at $DIR/match-arm-scopes.rs:16:16: 16:17 - debug t => _16; // in scope 2 at $DIR/match-arm-scopes.rs:16:19: 16:20 + } + scope 3 { + } + scope 4 { + debug b => _15; // in scope 4 at $DIR/match-arm-scopes.rs:16:16: 16:17 + debug t => _16; // in scope 4 at $DIR/match-arm-scopes.rs:16:19: 16:20 } bb0: { @@ -83,15 +87,15 @@ - _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 - _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 StorageLive(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 - StorageLive(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 - _10 = _1; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 -- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 -+ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 + StorageLive(_10); // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 + _10 = _1; // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 +- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 ++ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 } - bb9: { + bb6: { - _0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60 + _0 = const 3_i32; // scope 2 at $DIR/match-arm-scopes.rs:15:59: 15:60 StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - goto -> bb23; // scope 0 at no-location @@ -140,15 +144,15 @@ - _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 - _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 StorageLive(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 - StorageLive(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 - _13 = _1; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 -- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 -+ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 + StorageLive(_13); // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 + _13 = _1; // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 +- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 ++ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 } - bb14: { + bb11: { - _0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60 + _0 = const 3_i32; // scope 3 at $DIR/match-arm-scopes.rs:15:59: 15:60 StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - goto -> bb23; // scope 0 at no-location @@ -200,7 +204,7 @@ - bb19: { + bb16: { - _0 = const 2_i32; // scope 2 at $DIR/match-arm-scopes.rs:16:41: 16:42 + _0 = const 2_i32; // scope 4 at $DIR/match-arm-scopes.rs:16:41: 16:42 - drop(_16) -> [return: bb21, unwind: bb25]; // scope 0 at $DIR/match-arm-scopes.rs:16:41: 16:42 + drop(_16) -> [return: bb18, unwind: bb22]; // scope 0 at $DIR/match-arm-scopes.rs:16:41: 16:42 } diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff index 29f66ceac981e..7736342316b59 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff @@ -6,24 +6,26 @@ let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25 let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26 + let mut _3: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 1 { + } bb0: { - _2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:17: 8:20 -- switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _2 = discriminant(_1); // scope 1 at $DIR/matches_reduce_branches.rs:8:17: 8:20 +- switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb1: { -- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb2: { -- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb3: { -+ StorageLive(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _3 = move _2; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ StorageDead(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ StorageLive(_3); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ _3 = move _2; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ StorageDead(_3); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2 } } diff --git a/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir b/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir index e3b318c949fc6..4cac6a007f3b3 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir +++ b/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir @@ -3,6 +3,8 @@ fn foo(_1: Option<()>) -> () { debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11 let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25 + scope 1 { + } bb0: { return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2 diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff index 2dfb2e1af0d63..95ce545bbd412 100644 --- a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff +++ b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff @@ -9,31 +9,37 @@ scope 1 { debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:40:9: 40:12 } + scope 2 { + scope 3 { + scope 4 { + } + } + } bb0: { StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12 - StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - _2 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + StorageLive(_2); // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - } - - bb1: { -+ StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -+ _3 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 ++ StorageLive(_3); // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ _3 = move _2; // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + StorageDead(_2); // scope 3 at $DIR/matches_reduce_branches.rs:41:51: 41:52 - _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 - } - - bb2: { -- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 +- StorageDead(_2); // scope 3 at $DIR/matches_reduce_branches.rs:41:51: 41:52 - _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 - } - - bb3: { + _1 = Ne(_3, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 -+ StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ StorageDead(_3); // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 _0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:51:5: 51:8 StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:52:1: 52:2 return; // scope 0 at $DIR/matches_reduce_branches.rs:52:2: 52:2 diff --git a/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff b/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff index dbcb8813d5458..23a388aadde71 100644 --- a/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff +++ b/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff @@ -4,6 +4,8 @@ fn test(_1: bool) -> () { debug x => _1; // in scope 0 at $DIR/multiple_return_terminators.rs:4:9: 4:10 let mut _0: (); // return place in scope 0 at $DIR/multiple_return_terminators.rs:4:18: 4:18 + scope 1 { + } bb0: { return; // scope 0 at $DIR/multiple_return_terminators.rs:10:2: 10:2 diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 162cacef8a54a..4a0a7b24aa3d9 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -39,6 +39,8 @@ fn main() -> () { let _6: &'_#5r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 scope 3 { debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:10 + scope 4 { + } } } } @@ -61,25 +63,25 @@ fn main() -> () { StorageLive(_6); // bb1[2]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 _6 = _2; // bb1[3]: scope 2 at $DIR/region-subtyping-basic.rs:19:13: 19:14 FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 - StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + StorageLive(_7); // bb1[5]: scope 4 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 4 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 4 at $DIR/region-subtyping-basic.rs:20:8: 20:12 } bb2: { - StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 - StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _8 = ConstValue(Scalar(): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + StorageLive(_8); // bb2[0]: scope 4 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + StorageLive(_9); // bb2[1]: scope 4 at $DIR/region-subtyping-basic.rs:21:15: 21:17 + _9 = (*_6); // bb2[2]: scope 4 at $DIR/region-subtyping-basic.rs:21:15: 21:17 + _8 = ConstValue(Scalar(): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 4 at $DIR/region-subtyping-basic.rs:21:9: 21:18 // mir::Constant // + span: $DIR/region-subtyping-basic.rs:21:9: 21:14 // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar()) } } bb3: { - StorageDead(_9); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 - StorageDead(_8); // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = const ConstValue(Scalar(): ()); // bb3[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 + StorageDead(_9); // bb3[0]: scope 4 at $DIR/region-subtyping-basic.rs:21:17: 21:18 + StorageDead(_8); // bb3[1]: scope 4 at $DIR/region-subtyping-basic.rs:21:18: 21:19 + _0 = const ConstValue(Scalar(): ()); // bb3[2]: scope 4 at $DIR/region-subtyping-basic.rs:20:13: 22:6 goto -> bb6; // bb3[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } diff --git a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff index 249db1c8a5ab2..349dbbb2679d2 100644 --- a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff +++ b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff @@ -6,19 +6,21 @@ let mut _0: u32; // return place in scope 0 at $DIR/not_equal_false.rs:3:20: 3:23 let mut _2: bool; // in scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 let mut _3: bool; // in scope 0 at $DIR/not_equal_false.rs:4:8: 4:9 + scope 1 { + } bb0: { - StorageLive(_2); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 - StorageLive(_3); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:9 - _3 = _1; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:9 -- _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 -+ _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 - StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 + StorageLive(_2); // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 + StorageLive(_3); // scope 1 at $DIR/not_equal_false.rs:4:8: 4:9 + _3 = _1; // scope 1 at $DIR/not_equal_false.rs:4:8: 4:9 +- _2 = Ne(move _3, const false); // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 ++ _2 = move _3; // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 + StorageDead(_3); // scope 1 at $DIR/not_equal_false.rs:4:17: 4:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/not_equal_false.rs:4:21: 4:22 + _0 = const 0_u32; // scope 1 at $DIR/not_equal_false.rs:4:21: 4:22 goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:35 } diff --git a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir index 69742d6bc3b6a..c1fe50afff2e5 100644 --- a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -51,9 +51,11 @@ fn array_casts() -> () { scope 7 { debug left_val => _20; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _21; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _27: core::panicking::AssertKind; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 8 { - debug kind => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: core::panicking::AssertKind; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + scope 9 { + debug kind => _27; // in scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } } } } @@ -137,41 +139,41 @@ fn array_casts() -> () { StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _21 = (_13.1: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL Retag(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = (*_20); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = (*_21); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = Eq(move _24, move _25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _22) -> [false: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = (*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = Eq(move _24, move _25); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_24); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = Not(move _23); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_23); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _22) -> [false: bb4, otherwise: bb3]; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { - StorageLive(_27); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _27 = core::panicking::AssertKind::Eq; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_28); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_29); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _29 = move _27; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _31 = &(*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _30 = &(*_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _33 = &(*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _32 = &(*_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _34 = Option::::None; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _28 = core::panicking::assert_failed::(move _29, move _30, move _32, move _34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = core::panicking::AssertKind::Eq; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = move _27; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = &(*_20); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_31); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = &(*_31); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_30); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_32); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_33); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = &(*_21); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_33); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _32 = &(*_33); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_32); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_34); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = Option::::None; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = core::panicking::assert_failed::(move _29, move _30, move _32, move _34); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r usize, &'s usize, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff index 1c5a890023648..06c4b997c7c33 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff @@ -6,6 +6,8 @@ let mut _1: (); // in scope 0 at $DIR/simplify_cfg.rs:7:1: 13:2 let mut _2: bool; // in scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 let mut _3: !; // in scope 0 at $DIR/simplify_cfg.rs:9:18: 11:10 + scope 1 { + } bb0: { goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 @@ -16,23 +18,23 @@ - } - - bb2: { - StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 -- _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 -+ _2 = bar() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + StorageLive(_2); // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 +- _2 = bar() -> [return: bb3, unwind: bb6]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 ++ _2 = bar() -> [return: bb2, unwind: bb5]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 // mir::Constant // + span: $DIR/simplify_cfg.rs:9:12: 9:15 // + literal: Const { ty: fn() -> bool {bar}, val: Value(Scalar()) } } - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 +- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 + bb2: { -+ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 ++ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 } - bb4: { + bb3: { - _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 + _0 = const (); // scope 1 at $DIR/simplify_cfg.rs:10:13: 10:18 StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 return; // scope 0 at $DIR/simplify_cfg.rs:13:2: 13:2 } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff index b079bd7b57c42..ed2bda1a47491 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff @@ -6,6 +6,8 @@ let mut _1: (); // in scope 0 at $DIR/simplify_cfg.rs:7:1: 13:2 let mut _2: bool; // in scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 let mut _3: !; // in scope 0 at $DIR/simplify_cfg.rs:9:18: 11:10 + scope 1 { + } bb0: { goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 @@ -17,31 +19,31 @@ } bb2: { - StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 -- _2 = bar() -> [return: bb3, unwind: bb11]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 -+ _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + StorageLive(_2); // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 +- _2 = bar() -> [return: bb3, unwind: bb11]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 ++ _2 = bar() -> [return: bb3, unwind: bb6]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 // mir::Constant // + span: $DIR/simplify_cfg.rs:9:12: 9:15 // + literal: Const { ty: fn() -> bool {bar}, val: Value(Scalar()) } } bb3: { - switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 } bb4: { - _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 -- goto -> bb10; // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 + _0 = const (); // scope 1 at $DIR/simplify_cfg.rs:10:13: 10:18 +- goto -> bb10; // scope 1 at $DIR/simplify_cfg.rs:10:13: 10:18 + StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 + return; // scope 0 at $DIR/simplify_cfg.rs:13:2: 13:2 } bb5: { -- goto -> bb8; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 +- goto -> bb8; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 - } - - bb6: { -- unreachable; // scope 0 at $DIR/simplify_cfg.rs:9:18: 11:10 +- unreachable; // scope 1 at $DIR/simplify_cfg.rs:9:18: 11:10 - } - - bb7: { diff --git a/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff b/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff index d11c70b1efec6..2f9e45279d86e 100644 --- a/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff +++ b/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff @@ -5,25 +5,27 @@ let mut _0: (); // return place in scope 0 at $DIR/simplify_if.rs:5:11: 5:11 let mut _1: bool; // in scope 0 at $DIR/simplify_if.rs:6:8: 6:13 let _2: (); // in scope 0 at $DIR/simplify_if.rs:7:9: 7:15 + scope 1 { + } bb0: { - StorageLive(_1); // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 - _1 = const false; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 -- switchInt(const false) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 -+ goto -> bb3; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 + StorageLive(_1); // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 + _1 = const false; // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 +- switchInt(const false) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 ++ goto -> bb3; // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 } bb1: { - StorageLive(_2); // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 - _2 = noop() -> bb2; // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 + StorageLive(_2); // scope 1 at $DIR/simplify_if.rs:7:9: 7:15 + _2 = noop() -> bb2; // scope 1 at $DIR/simplify_if.rs:7:9: 7:15 // mir::Constant // + span: $DIR/simplify_if.rs:7:9: 7:13 // + literal: Const { ty: fn() {noop}, val: Value(Scalar()) } } bb2: { - StorageDead(_2); // scope 0 at $DIR/simplify_if.rs:7:15: 7:16 - nop; // scope 0 at $DIR/simplify_if.rs:6:14: 8:6 + StorageDead(_2); // scope 1 at $DIR/simplify_if.rs:7:15: 7:16 + nop; // scope 1 at $DIR/simplify_if.rs:6:14: 8:6 goto -> bb4; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index 7137e01fae3b9..d220d92902098 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -13,6 +13,8 @@ scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 + scope 2 { + } } bb0: { @@ -40,12 +42,12 @@ bb2: { StorageLive(_6); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 -- StorageLive(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageLive(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _8 = _6; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _7 = Gt(move _8, const 42_u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageDead(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 -- StorageDead(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 +- StorageLive(_7); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageLive(_8); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _8 = _6; // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _7 = Gt(move _8, const 42_u8); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageDead(_8); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 +- StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 } diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index fa8fd0a3c1170..e87c59a4c7708 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -5,16 +5,18 @@ let mut _0: (); // return place in scope 0 at $DIR/unreachable.rs:8:11: 8:11 let mut _1: std::option::Option; // in scope 0 at $DIR/unreachable.rs:9:23: 9:30 let mut _2: isize; // in scope 0 at $DIR/unreachable.rs:9:12: 9:20 - let mut _4: i32; // in scope 0 at $DIR/unreachable.rs:10:13: 10:19 let _5: (); // in scope 0 at $DIR/unreachable.rs:12:9: 16:10 let mut _6: bool; // in scope 0 at $DIR/unreachable.rs:12:12: 12:16 let mut _7: !; // in scope 0 at $DIR/unreachable.rs:18:9: 18:21 scope 1 { debug _x => _3; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 let _3: Empty; // in scope 1 at $DIR/unreachable.rs:9:17: 9:19 - } - scope 2 { - debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:10:13: 10:19 + scope 2 { + debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 + scope 3 { + } + } } bb0: { @@ -34,16 +36,16 @@ bb2: { - StorageLive(_3); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 - _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 -- StorageLive(_4); // scope 0 at $DIR/unreachable.rs:10:13: 10:19 +- StorageLive(_4); // scope 1 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 -- StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 -- _6 = const true; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 +- StorageLive(_6); // scope 3 at $DIR/unreachable.rs:12:12: 12:16 +- _6 = const true; // scope 3 at $DIR/unreachable.rs:12:12: 12:16 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 3 at $DIR/unreachable.rs:12:12: 12:16 - } - - bb3: { -- _4 = const 21_i32; // scope 2 at $DIR/unreachable.rs:13:13: 13:20 -- _5 = const (); // scope 2 at $DIR/unreachable.rs:12:17: 14:10 +- _4 = const 21_i32; // scope 3 at $DIR/unreachable.rs:13:13: 13:20 +- _5 = const (); // scope 3 at $DIR/unreachable.rs:12:17: 14:10 - goto -> bb5; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - } - diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index 48c9f6bf27159..b63a2f2b0ac4d 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -14,6 +14,8 @@ scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 + scope 3 { + } } } @@ -36,31 +38,31 @@ bb2: { StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 - StorageLive(_5); // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 - StorageLive(_6); // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 - _6 = _1; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -+ goto -> bb3; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 + StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 + StorageLive(_6); // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 + _6 = _1; // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 ++ goto -> bb3; // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 } bb3: { -- _5 = loop_forever() -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = loop_forever() -> bb4; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 +- _5 = loop_forever() -> bb5; // scope 3 at $DIR/unreachable_diverging.rs:16:13: 16:27 ++ _5 = loop_forever() -> bb4; // scope 3 at $DIR/unreachable_diverging.rs:16:13: 16:27 // mir::Constant // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 // + literal: Const { ty: fn() {loop_forever}, val: Value(Scalar()) } } bb4: { -- _5 = const (); // scope 1 at $DIR/unreachable_diverging.rs:17:10: 17:10 -- goto -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- _5 = const (); // scope 2 at $DIR/unreachable_diverging.rs:17:10: 17:10 +- goto -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - - bb5: { - StorageDead(_6); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageDead(_5); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 - StorageLive(_7); // scope 1 at $DIR/unreachable_diverging.rs:18:9: 18:22 - unreachable; // scope 1 at $DIR/unreachable_diverging.rs:18:15: 18:19 + StorageDead(_6); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageDead(_5); // scope 2 at $DIR/unreachable_diverging.rs:17:9: 17:10 + StorageLive(_7); // scope 2 at $DIR/unreachable_diverging.rs:18:9: 18:22 + unreachable; // scope 2 at $DIR/unreachable_diverging.rs:18:15: 18:19 } - bb6: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff index d6156eaaf4823..f8b41d7b4c5df 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff @@ -34,9 +34,9 @@ } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir index ec2d161251b00..df5a3cb31514d 100644 --- a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -7,48 +7,52 @@ fn while_loop(_1: bool) -> () { let mut _3: bool; // in scope 0 at $DIR/while-storage.rs:10:20: 10:21 let mut _4: bool; // in scope 0 at $DIR/while-storage.rs:11:12: 11:23 let mut _5: bool; // in scope 0 at $DIR/while-storage.rs:11:21: 11:22 + scope 1 { + scope 2 { + } + } bb0: { goto -> bb1; // scope 0 at $DIR/while-storage.rs:10:5: 14:6 } bb1: { - StorageLive(_2); // scope 0 at $DIR/while-storage.rs:10:11: 10:22 - StorageLive(_3); // scope 0 at $DIR/while-storage.rs:10:20: 10:21 - _3 = _1; // scope 0 at $DIR/while-storage.rs:10:20: 10:21 - _2 = get_bool(move _3) -> bb2; // scope 0 at $DIR/while-storage.rs:10:11: 10:22 + StorageLive(_2); // scope 1 at $DIR/while-storage.rs:10:11: 10:22 + StorageLive(_3); // scope 1 at $DIR/while-storage.rs:10:20: 10:21 + _3 = _1; // scope 1 at $DIR/while-storage.rs:10:20: 10:21 + _2 = get_bool(move _3) -> bb2; // scope 1 at $DIR/while-storage.rs:10:11: 10:22 // mir::Constant // + span: $DIR/while-storage.rs:10:11: 10:19 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar()) } } bb2: { - StorageDead(_3); // scope 0 at $DIR/while-storage.rs:10:21: 10:22 - switchInt(move _2) -> [false: bb7, otherwise: bb3]; // scope 0 at $DIR/while-storage.rs:10:11: 10:22 + StorageDead(_3); // scope 1 at $DIR/while-storage.rs:10:21: 10:22 + switchInt(move _2) -> [false: bb7, otherwise: bb3]; // scope 1 at $DIR/while-storage.rs:10:11: 10:22 } bb3: { - StorageLive(_4); // scope 0 at $DIR/while-storage.rs:11:12: 11:23 - StorageLive(_5); // scope 0 at $DIR/while-storage.rs:11:21: 11:22 - _5 = _1; // scope 0 at $DIR/while-storage.rs:11:21: 11:22 - _4 = get_bool(move _5) -> bb4; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 + StorageLive(_4); // scope 2 at $DIR/while-storage.rs:11:12: 11:23 + StorageLive(_5); // scope 2 at $DIR/while-storage.rs:11:21: 11:22 + _5 = _1; // scope 2 at $DIR/while-storage.rs:11:21: 11:22 + _4 = get_bool(move _5) -> bb4; // scope 2 at $DIR/while-storage.rs:11:12: 11:23 // mir::Constant // + span: $DIR/while-storage.rs:11:12: 11:20 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar()) } } bb4: { - StorageDead(_5); // scope 0 at $DIR/while-storage.rs:11:22: 11:23 - switchInt(move _4) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 + StorageDead(_5); // scope 2 at $DIR/while-storage.rs:11:22: 11:23 + switchInt(move _4) -> [false: bb6, otherwise: bb5]; // scope 2 at $DIR/while-storage.rs:11:12: 11:23 } bb5: { - StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 - goto -> bb8; // scope 0 at no-location + StorageDead(_4); // scope 1 at $DIR/while-storage.rs:13:9: 13:10 + goto -> bb8; // scope 1 at no-location } bb6: { - StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 + StorageDead(_4); // scope 1 at $DIR/while-storage.rs:13:9: 13:10 StorageDead(_2); // scope 0 at $DIR/while-storage.rs:14:5: 14:6 goto -> bb1; // scope 0 at $DIR/while-storage.rs:10:5: 14:6 } From a5e27a113445498b7b435bcd04e26ad1d71defab Mon Sep 17 00:00:00 2001 From: Xavier Denis Date: Fri, 10 Jun 2022 14:12:58 -0700 Subject: [PATCH 5/6] Only create scopes for if let --- .../rustc_mir_build/src/build/expr/into.rs | 24 +++- .../bool_compare.opt1.InstCombine.diff | 18 ++- .../bool_compare.opt2.InstCombine.diff | 18 ++- .../bool_compare.opt3.InstCombine.diff | 18 ++- .../bool_compare.opt4.InstCombine.diff | 18 ++- .../const_goto.issue_77355_opt.ConstGoto.diff | 24 ++-- ...oto_storage.match_nested_if.ConstGoto.diff | 52 ++++----- ...l_flow_simplification.hello.ConstProp.diff | 16 ++- ...simplification.hello.PreCodegen.before.mir | 2 - .../discriminant.main.ConstProp.32bit.diff | 22 ++-- .../cycle.cycle.DeadStoreElimination.diff | 60 +++++----- ...egator_test_enum_2.test1.Deaggregator.diff | 22 ++-- .../branch.main.DestinationPropagation.diff | 10 +- .../mir-opt/equal_true.opt.InstCombine.diff | 18 ++- ...t_opt_bool.SimplifyComparisonIntegral.diff | 10 +- ...opt_floats.SimplifyComparisonIntegral.diff | 16 ++- ...t.opt_char.SimplifyComparisonIntegral.diff | 26 ++--- ...int.opt_i8.SimplifyComparisonIntegral.diff | 26 ++--- ...ltiple_ifs.SimplifyComparisonIntegral.diff | 52 ++++----- ...t_negative.SimplifyComparisonIntegral.diff | 26 ++--- ...nt.opt_u32.SimplifyComparisonIntegral.diff | 26 ++--- .../inline/inline_diverging.g.Inline.diff | 30 +++-- .../inline/inline_generator.main.Inline.diff | 10 +- ...e_38669.main.SimplifyCfg-initial.after.mir | 10 +- .../issue_41888.main.ElaborateDrops.after.mir | 70 ++++++------ .../issue_73223.main.PreCodegen.64bit.diff | 52 +++++---- ..._73223.main.SimplifyArmIdentity.64bit.diff | 66 ++++++----- ...ue_59352.num_to_digit.PreCodegen.after.mir | 106 +++++++++--------- ....main.SimplifyCfg-promote-consts.after.mir | 12 +- ...wer_array_len.array_bound.InstCombine.diff | 60 +++++----- ...ray_len.array_bound.NormalizeArrayLen.diff | 58 +++++----- ..._array_len.array_bound.SimplifyLocals.diff | 62 +++++----- ...array_len.array_bound_mut.InstCombine.diff | 58 +++++----- ...len.array_bound_mut.NormalizeArrayLen.diff | 58 +++++----- ...ay_len.array_bound_mut.SimplifyLocals.diff | 62 +++++----- ...wer_intrinsics.f_u64.PreCodegen.before.mir | 4 +- ...er_intrinsics.f_unit.PreCodegen.before.mir | 10 +- ...er_slice_len.bound.LowerSliceLenCalls.diff | 44 ++++---- ...fg-initial.after-ElaborateDrops.after.diff | 30 +++-- ...s.foo.MatchBranchSimplification.64bit.diff | 16 ++- ...e_branches.foo.PreCodegen.before.64bit.mir | 2 - ...ed_if.MatchBranchSimplification.64bit.diff | 22 ++-- ...nators.test.MultipleReturnTerminators.diff | 2 - ...egion_subtyping_basic.main.nll.0.64bit.mir | 22 ++-- .../not_equal_false.opt.InstCombine.diff | 18 ++- ...asts.SimplifyCfg-elaborate-drops.after.mir | 70 ++++++------ ...mplify_cfg.main.SimplifyCfg-early-opt.diff | 14 +-- ...simplify_cfg.main.SimplifyCfg-initial.diff | 18 ++- ...mplifyConstCondition-after-const-prop.diff | 18 ++- ..._locals_fixedpoint.foo.SimplifyLocals.diff | 12 +- ...reachable.main.UnreachablePropagation.diff | 12 +- ...diverging.main.UnreachablePropagation.diff | 14 +-- ...oops.change_loop_body.ConstProp.32bit.diff | 24 ++-- ...hange_loop_body.PreCodegen.after.32bit.mir | 2 + ...le_storage.while_loop.PreCodegen.after.mir | 34 +++--- 55 files changed, 756 insertions(+), 850 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index 182a9a5cc5d06..cffb67ef01328 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -63,9 +63,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { (if_then_scope, then_source_info), LintLevel::Inherited, |this| { - let variable_scope = - this.new_source_scope(then_expr.span, LintLevel::Inherited, None); - this.source_scope = variable_scope; + let source_info = if this.is_let(cond) { + let variable_scope = this.new_source_scope( + then_expr.span, + LintLevel::Inherited, + None, + ); + this.source_scope = variable_scope; + SourceInfo { span: then_expr.span, scope: variable_scope } + } else { + this.source_info(then_expr.span) + }; let (then_block, else_block) = this.in_if_then_scope(condition_scope, |this| { let then_blk = unpack!(this.then_else_break( @@ -73,7 +81,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &this.thir[cond], Some(condition_scope), condition_scope, - SourceInfo { span: then_expr.span, scope: variable_scope } + source_info )); this.expr_into_dest(destination, then_blk, then_expr) @@ -579,4 +587,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { block_and } + + fn is_let(&self, expr: ExprId) -> bool { + match self.thir[expr].kind { + ExprKind::Let { .. } => true, + ExprKind::Scope { value, .. } => self.is_let(value), + _ => false, + } + } } diff --git a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff index ff608f7f5cebf..8f57d307abf58 100644 --- a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff @@ -6,21 +6,19 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:2:21: 2:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:3:8: 3:17 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:3:8: 3:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 - StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:3:8: 3:9 - _3 = _1; // scope 1 at $DIR/bool_compare.rs:3:8: 3:9 -- _2 = Ne(move _3, const true); // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 -+ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 - StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:3:16: 3:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:3:8: 3:17 + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:3:8: 3:9 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:3:8: 3:9 +- _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:3:16: 3:17 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 } bb1: { - _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:3:20: 3:21 + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:3:20: 3:21 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:3:5: 3:34 } diff --git a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff index 8395b22b8e2e7..1f5738ae75837 100644 --- a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff @@ -6,21 +6,19 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:7:21: 7:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:8:8: 8:17 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:8:16: 8:17 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 - StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:8:16: 8:17 - _3 = _1; // scope 1 at $DIR/bool_compare.rs:8:16: 8:17 -- _2 = Ne(const true, move _3); // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 -+ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 - StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:8:16: 8:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:8:8: 8:17 + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 +- _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 } bb1: { - _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:8:20: 8:21 + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:8:20: 8:21 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:8:5: 8:34 } diff --git a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff index 413b5fdf20850..3320509a7b37a 100644 --- a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff @@ -6,21 +6,19 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:12:21: 12:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:13:8: 13:18 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:13:8: 13:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 - StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:13:8: 13:9 - _3 = _1; // scope 1 at $DIR/bool_compare.rs:13:8: 13:9 -- _2 = Eq(move _3, const false); // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 -+ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 - StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:13:17: 13:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:13:8: 13:18 + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:9 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:13:8: 13:9 +- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:13:17: 13:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 } bb1: { - _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:13:21: 13:22 + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:13:21: 13:22 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:13:5: 13:35 } diff --git a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff index ba4496aa2c9f4..02049f4126da5 100644 --- a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff @@ -6,21 +6,19 @@ let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:17:21: 17:24 let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:18:8: 18:18 let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:18:17: 18:18 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 - StorageLive(_3); // scope 1 at $DIR/bool_compare.rs:18:17: 18:18 - _3 = _1; // scope 1 at $DIR/bool_compare.rs:18:17: 18:18 -- _2 = Eq(const false, move _3); // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 -+ _2 = Not(move _3); // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 - StorageDead(_3); // scope 1 at $DIR/bool_compare.rs:18:17: 18:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/bool_compare.rs:18:8: 18:18 + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 +- _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 } bb1: { - _0 = const 0_u32; // scope 1 at $DIR/bool_compare.rs:18:21: 18:22 + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:18:21: 18:22 goto -> bb3; // scope 0 at $DIR/bool_compare.rs:18:5: 18:35 } diff --git a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff index 3173d09fddc13..544d16a251a82 100644 --- a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff +++ b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff @@ -7,35 +7,33 @@ - let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _3: isize; // in scope 0 at $DIR/const_goto.rs:12:22: 12:28 + let mut _2: isize; // in scope 0 at $DIR/const_goto.rs:12:22: 12:28 - scope 1 { - } bb0: { -- StorageLive(_2); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- _3 = discriminant(_1); // scope 1 at $DIR/const_goto.rs:12:17: 12:20 -- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _2 = discriminant(_1); // scope 1 at $DIR/const_goto.rs:12:17: 12:20 -+ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- _3 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:12:17: 12:20 +- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ _2 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:12:17: 12:20 ++ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { -- _2 = const false; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const 42_u64; // scope 0 at $DIR/const_goto.rs:12:53: 12:55 + goto -> bb3; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 } bb2: { -- _2 = const true; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb4: { - _0 = const 23_u64; // scope 1 at $DIR/const_goto.rs:12:41: 12:43 + _0 = const 23_u64; // scope 0 at $DIR/const_goto.rs:12:41: 12:43 - goto -> bb6; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 + goto -> bb3; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 } diff --git a/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff b/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff index 33925e41faa62..62a681e1c12a7 100644 --- a/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff +++ b/src/test/mir-opt/const_goto_storage.match_nested_if.ConstGoto.diff @@ -13,60 +13,54 @@ scope 1 { debug val => _1; // in scope 1 at $DIR/const_goto_storage.rs:3:9: 3:12 } - scope 2 { - scope 3 { - scope 4 { - } - } - } bb0: { StorageLive(_1); // scope 0 at $DIR/const_goto_storage.rs:3:9: 3:12 - StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:3:21: 3:23 - nop; // scope 0 at $DIR/const_goto_storage.rs:3:21: 3:23 - StorageLive(_3); // scope 0 at $DIR/const_goto_storage.rs:4:15: 8:10 -- StorageLive(_4); // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 -- StorageLive(_5); // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 -- StorageLive(_6); // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 -- _6 = const true; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 -+ StorageLive(_2); // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 -+ _2 = const true; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 -+ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 4 at $DIR/const_goto_storage.rs:4:24: 4:28 +- StorageLive(_4); // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 +- StorageLive(_5); // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 +- StorageLive(_6); // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 +- _6 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 +- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 ++ StorageLive(_2); // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 ++ _2 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 ++ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_storage.rs:4:24: 4:28 } bb1: { -- _5 = const true; // scope 4 at $DIR/const_goto_storage.rs:4:31: 4:35 -- goto -> bb3; // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 +- _5 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:31: 4:35 +- goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 - } - - bb2: { -- _5 = const false; // scope 3 at $DIR/const_goto_storage.rs:4:45: 4:50 -- goto -> bb3; // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 +- _5 = const false; // scope 0 at $DIR/const_goto_storage.rs:4:45: 4:50 +- goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 - } - - bb3: { -- StorageDead(_6); // scope 3 at $DIR/const_goto_storage.rs:4:51: 4:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 3 at $DIR/const_goto_storage.rs:4:21: 4:52 +- StorageDead(_6); // scope 0 at $DIR/const_goto_storage.rs:4:51: 4:52 +- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_storage.rs:4:21: 4:52 - } - - bb4: { -- _4 = const true; // scope 3 at $DIR/const_goto_storage.rs:4:55: 4:59 -- goto -> bb6; // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 +- _4 = const true; // scope 0 at $DIR/const_goto_storage.rs:4:55: 4:59 +- goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 - } - - bb5: { -- _4 = const false; // scope 2 at $DIR/const_goto_storage.rs:4:69: 4:74 -- goto -> bb6; // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 +- _4 = const false; // scope 0 at $DIR/const_goto_storage.rs:4:69: 4:74 +- goto -> bb6; // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 - } - - bb6: { -- StorageDead(_5); // scope 2 at $DIR/const_goto_storage.rs:4:75: 4:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 2 at $DIR/const_goto_storage.rs:4:18: 4:76 +- StorageDead(_5); // scope 0 at $DIR/const_goto_storage.rs:4:75: 4:76 +- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/const_goto_storage.rs:4:18: 4:76 - } - - bb7: { -- _3 = const true; // scope 2 at $DIR/const_goto_storage.rs:5:13: 5:17 +- _3 = const true; // scope 0 at $DIR/const_goto_storage.rs:5:13: 5:17 - goto -> bb9; // scope 0 at $DIR/const_goto_storage.rs:4:15: 8:10 - } - @@ -82,7 +76,7 @@ - bb10: { - StorageDead(_4); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 - StorageDead(_3); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 -+ StorageDead(_2); // scope 3 at $DIR/const_goto_storage.rs:4:51: 4:52 ++ StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:4:51: 4:52 _1 = const true; // scope 0 at $DIR/const_goto_storage.rs:10:17: 10:21 - goto -> bb12; // scope 0 at $DIR/const_goto_storage.rs:10:17: 10:21 + goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:10:17: 10:21 @@ -92,7 +86,7 @@ - StorageDead(_4); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 - StorageDead(_3); // scope 0 at $DIR/const_goto_storage.rs:8:9: 8:10 + bb2: { -+ StorageDead(_2); // scope 3 at $DIR/const_goto_storage.rs:4:51: 4:52 ++ StorageDead(_2); // scope 0 at $DIR/const_goto_storage.rs:4:51: 4:52 _1 = const false; // scope 0 at $DIR/const_goto_storage.rs:12:14: 12:19 - goto -> bb12; // scope 0 at $DIR/const_goto_storage.rs:12:14: 12:19 + goto -> bb3; // scope 0 at $DIR/const_goto_storage.rs:12:14: 12:19 diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index 3d9517fb504c3..d7636c817099a 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -5,20 +5,18 @@ let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14 let mut _1: bool; // in scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 let mut _2: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL - scope 1 { - } bb0: { - StorageLive(_1); // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 -- _1 = const ::NEEDS; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 -- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 -+ _1 = const false; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 -+ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/control-flow-simplification.rs:12:8: 12:21 + StorageLive(_1); // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 +- _1 = const ::NEEDS; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 +- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 ++ _1 = const false; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 ++ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 } bb1: { - StorageLive(_2); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL - _2 = begin_panic::<&str>(const "explicit panic"); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL + StorageLive(_2); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL + _2 = begin_panic::<&str>(const "explicit panic"); // scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL // mir::Constant // + span: $SRC_DIR/std/src/panic.rs:LL:COL // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir b/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir index 4b11e4ebec6ac..30512d0bbe874 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir @@ -2,8 +2,6 @@ fn hello() -> () { let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14 - scope 1 { - } bb0: { return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2 diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index 445732f70220a..047853696f228 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -10,26 +10,28 @@ scope 1 { debug x => _1; // in scope 1 at $DIR/discriminant.rs:11:9: 11:10 } + scope 2 { + } bb0: { 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 - Deinit(_3); // 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 - 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: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + StorageLive(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + Deinit(_3); // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + ((_3 as Some).0: bool) = const true; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 + discriminant(_3) = 1; // scope 2 at $DIR/discriminant.rs:11:34: 11:44 +- _4 = discriminant(_3); // scope 2 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ _4 = const 1_isize; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 2 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 42_i32; // scope 2 at $DIR/discriminant.rs:11:47: 11:49 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff index 9f2ae1c90cad3..6037f89086dc1 100644 --- a/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff +++ b/src/test/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.diff @@ -8,6 +8,7 @@ let mut _0: (); // return place in scope 0 at $DIR/cycle.rs:9:46: 9:46 let mut _4: (); // in scope 0 at $DIR/cycle.rs:9:1: 18:2 let mut _5: bool; // in scope 0 at $DIR/cycle.rs:12:11: 12:17 + let _6: i32; // in scope 0 at $DIR/cycle.rs:13:13: 13:17 let mut _7: i32; // in scope 0 at $DIR/cycle.rs:14:13: 14:14 let mut _8: i32; // in scope 0 at $DIR/cycle.rs:15:13: 15:14 let mut _9: i32; // in scope 0 at $DIR/cycle.rs:16:13: 16:17 @@ -15,10 +16,7 @@ let _11: (); // in scope 0 at $DIR/cycle.rs:12:5: 17:6 let mut _12: !; // in scope 0 at $DIR/cycle.rs:12:5: 17:6 scope 1 { - let _6: i32; // in scope 1 at $DIR/cycle.rs:13:13: 13:17 - scope 2 { - debug temp => _6; // in scope 2 at $DIR/cycle.rs:13:13: 13:17 - } + debug temp => _6; // in scope 1 at $DIR/cycle.rs:13:13: 13:17 } bb0: { @@ -26,42 +24,42 @@ } bb1: { - StorageLive(_5); // scope 1 at $DIR/cycle.rs:12:11: 12:17 - _5 = cond() -> bb2; // scope 1 at $DIR/cycle.rs:12:11: 12:17 + StorageLive(_5); // scope 0 at $DIR/cycle.rs:12:11: 12:17 + _5 = cond() -> bb2; // scope 0 at $DIR/cycle.rs:12:11: 12:17 // mir::Constant // + span: $DIR/cycle.rs:12:11: 12:15 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } } bb2: { - switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/cycle.rs:12:11: 12:17 + switchInt(move _5) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/cycle.rs:12:11: 12:17 } bb3: { - StorageLive(_6); // scope 1 at $DIR/cycle.rs:13:13: 13:17 -- _6 = _3; // scope 1 at $DIR/cycle.rs:13:20: 13:21 -+ nop; // scope 1 at $DIR/cycle.rs:13:20: 13:21 - StorageLive(_7); // scope 2 at $DIR/cycle.rs:14:13: 14:14 -- _7 = _2; // scope 2 at $DIR/cycle.rs:14:13: 14:14 -- _3 = move _7; // scope 2 at $DIR/cycle.rs:14:9: 14:14 -+ nop; // scope 2 at $DIR/cycle.rs:14:13: 14:14 -+ nop; // scope 2 at $DIR/cycle.rs:14:9: 14:14 - StorageDead(_7); // scope 2 at $DIR/cycle.rs:14:13: 14:14 - StorageLive(_8); // scope 2 at $DIR/cycle.rs:15:13: 15:14 -- _8 = _1; // scope 2 at $DIR/cycle.rs:15:13: 15:14 -- _2 = move _8; // scope 2 at $DIR/cycle.rs:15:9: 15:14 -+ nop; // scope 2 at $DIR/cycle.rs:15:13: 15:14 -+ nop; // scope 2 at $DIR/cycle.rs:15:9: 15:14 - StorageDead(_8); // scope 2 at $DIR/cycle.rs:15:13: 15:14 - StorageLive(_9); // scope 2 at $DIR/cycle.rs:16:13: 16:17 -- _9 = _6; // scope 2 at $DIR/cycle.rs:16:13: 16:17 -- _1 = move _9; // scope 2 at $DIR/cycle.rs:16:9: 16:17 -+ nop; // scope 2 at $DIR/cycle.rs:16:13: 16:17 -+ nop; // scope 2 at $DIR/cycle.rs:16:9: 16:17 - StorageDead(_9); // scope 2 at $DIR/cycle.rs:16:16: 16:17 -- _4 = const (); // scope 1 at $DIR/cycle.rs:12:18: 17:6 -+ nop; // scope 1 at $DIR/cycle.rs:12:18: 17:6 - StorageDead(_6); // scope 1 at $DIR/cycle.rs:17:5: 17:6 + StorageLive(_6); // scope 0 at $DIR/cycle.rs:13:13: 13:17 +- _6 = _3; // scope 0 at $DIR/cycle.rs:13:20: 13:21 ++ nop; // scope 0 at $DIR/cycle.rs:13:20: 13:21 + StorageLive(_7); // scope 1 at $DIR/cycle.rs:14:13: 14:14 +- _7 = _2; // scope 1 at $DIR/cycle.rs:14:13: 14:14 +- _3 = move _7; // scope 1 at $DIR/cycle.rs:14:9: 14:14 ++ nop; // scope 1 at $DIR/cycle.rs:14:13: 14:14 ++ nop; // scope 1 at $DIR/cycle.rs:14:9: 14:14 + StorageDead(_7); // scope 1 at $DIR/cycle.rs:14:13: 14:14 + StorageLive(_8); // scope 1 at $DIR/cycle.rs:15:13: 15:14 +- _8 = _1; // scope 1 at $DIR/cycle.rs:15:13: 15:14 +- _2 = move _8; // scope 1 at $DIR/cycle.rs:15:9: 15:14 ++ nop; // scope 1 at $DIR/cycle.rs:15:13: 15:14 ++ nop; // scope 1 at $DIR/cycle.rs:15:9: 15:14 + StorageDead(_8); // scope 1 at $DIR/cycle.rs:15:13: 15:14 + StorageLive(_9); // scope 1 at $DIR/cycle.rs:16:13: 16:17 +- _9 = _6; // scope 1 at $DIR/cycle.rs:16:13: 16:17 +- _1 = move _9; // scope 1 at $DIR/cycle.rs:16:9: 16:17 ++ nop; // scope 1 at $DIR/cycle.rs:16:13: 16:17 ++ nop; // scope 1 at $DIR/cycle.rs:16:9: 16:17 + StorageDead(_9); // scope 1 at $DIR/cycle.rs:16:16: 16:17 +- _4 = const (); // scope 0 at $DIR/cycle.rs:12:18: 17:6 ++ nop; // scope 0 at $DIR/cycle.rs:12:18: 17:6 + StorageDead(_6); // scope 0 at $DIR/cycle.rs:17:5: 17:6 StorageDead(_5); // scope 0 at $DIR/cycle.rs:17:5: 17:6 goto -> bb1; // scope 0 at $DIR/cycle.rs:12:5: 17:6 } diff --git a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff index 089f43b5169f4..5cfcef849e9db 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff +++ b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff @@ -8,23 +8,21 @@ let mut _3: bool; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 let mut _4: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 let mut _5: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17 - scope 1 { - } bb0: { - StorageLive(_3); // scope 1 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 - _3 = _1; // scope 1 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 - switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 + StorageLive(_3); // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 + _3 = _1; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 + switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 } bb1: { - StorageLive(_4); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 - _4 = _2; // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 -- _0 = Foo::A(move _4); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 -+ Deinit(_0); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 -+ ((_0 as A).0: i32) = move _4; // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 -+ discriminant(_0) = 0; // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 - StorageDead(_4); // scope 1 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18 + StorageLive(_4); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 + _4 = _2; // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17 +- _0 = Foo::A(move _4); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 ++ Deinit(_0); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 ++ ((_0 as A).0: i32) = move _4; // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 ++ discriminant(_0) = 0; // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18 + StorageDead(_4); // scope 0 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18 goto -> bb3; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6 } diff --git a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff index e33057e81fa1e..c3aa19e6c5f84 100644 --- a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff @@ -12,8 +12,6 @@ scope 2 { debug y => _2; // in scope 2 at $DIR/branch.rs:15:9: 15:10 } - scope 3 { - } } bb0: { @@ -26,19 +24,19 @@ bb1: { StorageLive(_2); // scope 1 at $DIR/branch.rs:15:9: 15:10 - StorageLive(_3); // scope 3 at $DIR/branch.rs:15:16: 15:22 - _3 = cond() -> bb2; // scope 3 at $DIR/branch.rs:15:16: 15:22 + StorageLive(_3); // scope 1 at $DIR/branch.rs:15:16: 15:22 + _3 = cond() -> bb2; // scope 1 at $DIR/branch.rs:15:16: 15:22 // mir::Constant // + span: $DIR/branch.rs:15:16: 15:20 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } } bb2: { - switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 3 at $DIR/branch.rs:15:16: 15:22 + switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:15:16: 15:22 } bb3: { - nop; // scope 3 at $DIR/branch.rs:16:9: 16:10 + nop; // scope 1 at $DIR/branch.rs:16:9: 16:10 goto -> bb6; // scope 1 at $DIR/branch.rs:15:13: 20:6 } diff --git a/src/test/mir-opt/equal_true.opt.InstCombine.diff b/src/test/mir-opt/equal_true.opt.InstCombine.diff index 56f2fede4377b..174095888b48a 100644 --- a/src/test/mir-opt/equal_true.opt.InstCombine.diff +++ b/src/test/mir-opt/equal_true.opt.InstCombine.diff @@ -6,21 +6,19 @@ let mut _0: i32; // return place in scope 0 at $DIR/equal_true.rs:3:20: 3:23 let mut _2: bool; // in scope 0 at $DIR/equal_true.rs:4:8: 4:17 let mut _3: bool; // in scope 0 at $DIR/equal_true.rs:4:8: 4:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/equal_true.rs:4:8: 4:17 - StorageLive(_3); // scope 1 at $DIR/equal_true.rs:4:8: 4:9 - _3 = _1; // scope 1 at $DIR/equal_true.rs:4:8: 4:9 -- _2 = Eq(move _3, const true); // scope 1 at $DIR/equal_true.rs:4:8: 4:17 -+ _2 = move _3; // scope 1 at $DIR/equal_true.rs:4:8: 4:17 - StorageDead(_3); // scope 1 at $DIR/equal_true.rs:4:16: 4:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/equal_true.rs:4:8: 4:17 + StorageLive(_2); // scope 0 at $DIR/equal_true.rs:4:8: 4:17 + StorageLive(_3); // scope 0 at $DIR/equal_true.rs:4:8: 4:9 + _3 = _1; // scope 0 at $DIR/equal_true.rs:4:8: 4:9 +- _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:4:8: 4:17 ++ _2 = move _3; // scope 0 at $DIR/equal_true.rs:4:8: 4:17 + StorageDead(_3); // scope 0 at $DIR/equal_true.rs:4:16: 4:17 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:4:8: 4:17 } bb1: { - _0 = const 0_i32; // scope 1 at $DIR/equal_true.rs:4:20: 4:21 + _0 = const 0_i32; // scope 0 at $DIR/equal_true.rs:4:20: 4:21 goto -> bb3; // scope 0 at $DIR/equal_true.rs:4:5: 4:34 } diff --git a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff index 1baa7c7677a06..dddb7acae2b2c 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff @@ -5,17 +5,15 @@ debug x => _1; // in scope 0 at $DIR/if-condition-int.rs:16:18: 16:19 let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:16:30: 16:33 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:17:8: 17:9 - _2 = _1; // scope 1 at $DIR/if-condition-int.rs:17:8: 17:9 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:17:8: 17:9 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 + _2 = _1; // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 } bb1: { - _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:17:12: 17:13 + _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:17:12: 17:13 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:17:5: 17:26 } diff --git a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index 13933ea52f707..2ff8386b205bd 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -6,20 +6,18 @@ let mut _0: i32; // return place in scope 0 at $DIR/if-condition-int.rs:52:31: 52:34 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 let mut _3: f32; // in scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:53:8: 53:18 - StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:53:8: 53:9 - _3 = _1; // scope 1 at $DIR/if-condition-int.rs:53:8: 53:9 - _2 = Eq(move _3, const -42f32); // scope 1 at $DIR/if-condition-int.rs:53:8: 53:18 - StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:53:17: 53:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:53:8: 53:18 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 + StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 + _3 = _1; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 + _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 + StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:53:17: 53:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 } bb1: { - _0 = const 0_i32; // scope 1 at $DIR/if-condition-int.rs:53:21: 53:22 + _0 = const 0_i32; // scope 0 at $DIR/if-condition-int.rs:53:21: 53:22 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:53:5: 53:35 } diff --git a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff index 543818fdda0e6..40de48385f02e 100644 --- a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff @@ -6,29 +6,27 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:20:25: 20:28 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 let mut _3: char; // in scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 - StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:9 - _3 = _1; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:9 -- _2 = Eq(move _3, const 'x'); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 -- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:21:15: 21:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 -+ nop; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 -+ nop; // scope 1 at $DIR/if-condition-int.rs:21:15: 21:16 -+ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 + StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 + _3 = _1; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 +- _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 +- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:15: 21:16 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 ++ nop; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 ++ nop; // scope 0 at $DIR/if-condition-int.rs:21:15: 21:16 ++ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 } bb1: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 - _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:21:19: 21:20 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 + _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:21:19: 21:20 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 } bb2: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:21:8: 21:16 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:21:30: 21:31 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 } diff --git a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff index 92e770c15e53c..28c36aed84c38 100644 --- a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff @@ -6,29 +6,27 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:24:21: 24:24 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 let mut _3: i8; // in scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 - StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:9 - _3 = _1; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:9 -- _2 = Eq(move _3, const 42_i8); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 -- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:25:14: 25:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 -+ nop; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 -+ nop; // scope 1 at $DIR/if-condition-int.rs:25:14: 25:15 -+ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 + StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 + _3 = _1; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 +- _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 +- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:14: 25:15 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 ++ nop; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 ++ nop; // scope 0 at $DIR/if-condition-int.rs:25:14: 25:15 ++ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 } bb1: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 - _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:25:18: 25:19 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 + _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:25:18: 25:19 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 } bb2: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:25:8: 25:15 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:25:29: 25:30 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 } diff --git a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff index 6a3d8a948be16..55932fee9600c 100644 --- a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff @@ -8,50 +8,46 @@ let mut _3: u32; // in scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 let mut _4: bool; // in scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 let mut _5: u32; // in scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 - scope 1 { - } - scope 2 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 - StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:9 - _3 = _1; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:9 -- _2 = Eq(move _3, const 42_u32); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 -- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:33:14: 33:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 -+ nop; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 -+ nop; // scope 1 at $DIR/if-condition-int.rs:33:14: 33:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 + StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 + _3 = _1; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 +- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 +- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:14: 33:15 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 ++ nop; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 ++ nop; // scope 0 at $DIR/if-condition-int.rs:33:14: 33:15 ++ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 } bb1: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 - _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:34:9: 34:10 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 + _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:34:9: 34:10 goto -> bb6; // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 } bb2: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:33:8: 33:15 - StorageLive(_4); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 - StorageLive(_5); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:16 - _5 = _1; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:16 -- _4 = Ne(move _5, const 21_u32); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 -- StorageDead(_5); // scope 2 at $DIR/if-condition-int.rs:35:21: 35:22 -- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 -+ nop; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 -+ nop; // scope 2 at $DIR/if-condition-int.rs:35:21: 35:22 -+ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 + StorageLive(_4); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 + StorageLive(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 + _5 = _1; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 +- _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 +- StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:21: 35:22 +- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 ++ nop; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 ++ nop; // scope 0 at $DIR/if-condition-int.rs:35:21: 35:22 ++ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 } bb3: { -+ StorageDead(_5); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 - _0 = const 1_u32; // scope 2 at $DIR/if-condition-int.rs:36:9: 36:10 ++ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 + _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:36:9: 36:10 goto -> bb5; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 } bb4: { -+ StorageDead(_5); // scope 2 at $DIR/if-condition-int.rs:35:15: 35:22 ++ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 _0 = const 2_u32; // scope 0 at $DIR/if-condition-int.rs:38:9: 38:10 goto -> bb5; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 } diff --git a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff index fa2ef0c1ec5b3..c4574b32a5999 100644 --- a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff @@ -6,29 +6,27 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:28:28: 28:31 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 let mut _3: i32; // in scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 - StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:9 - _3 = _1; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:9 -- _2 = Eq(move _3, const -42_i32); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 -- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:29:15: 29:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 -+ nop; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 -+ nop; // scope 1 at $DIR/if-condition-int.rs:29:15: 29:16 -+ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 + StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 + _3 = _1; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 +- _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 +- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:15: 29:16 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 ++ nop; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 ++ nop; // scope 0 at $DIR/if-condition-int.rs:29:15: 29:16 ++ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 } bb1: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 - _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:29:19: 29:20 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 + _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:29:19: 29:20 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 } bb2: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:29:8: 29:16 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:29:30: 29:31 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 } diff --git a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff index 9549e198060c4..88d9d5622b8ec 100644 --- a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff @@ -6,29 +6,27 @@ let mut _0: u32; // return place in scope 0 at $DIR/if-condition-int.rs:11:23: 11:26 let mut _2: bool; // in scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 let mut _3: u32; // in scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 - StorageLive(_3); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:9 - _3 = _1; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:9 -- _2 = Eq(move _3, const 42_u32); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 -- StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:12:14: 12:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 -+ nop; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 -+ nop; // scope 1 at $DIR/if-condition-int.rs:12:14: 12:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 + StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 + StorageLive(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 + _3 = _1; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 +- _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 +- StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:14: 12:15 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 ++ nop; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 ++ nop; // scope 0 at $DIR/if-condition-int.rs:12:14: 12:15 ++ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 } bb1: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 - _0 = const 0_u32; // scope 1 at $DIR/if-condition-int.rs:12:18: 12:19 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 + _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:12:18: 12:19 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 } bb2: { -+ StorageDead(_3); // scope 1 at $DIR/if-condition-int.rs:12:8: 12:15 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:12:29: 12:30 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 } diff --git a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff index 9a00bb809c6c1..da55260e284ea 100644 --- a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff @@ -9,26 +9,24 @@ let mut _4: i32; // in scope 0 at $DIR/inline-diverging.rs:14:9: 14:10 let mut _5: !; // in scope 0 at $DIR/inline-diverging.rs:15:12: 17:6 let _6: !; // in scope 0 at $DIR/inline-diverging.rs:16:9: 16:16 - scope 1 { - } -+ scope 2 (inlined panic) { // at $DIR/inline-diverging.rs:16:9: 16:16 -+ let mut _7: !; // in scope 2 at $SRC_DIR/std/src/panic.rs:LL:COL ++ scope 1 (inlined panic) { // at $DIR/inline-diverging.rs:16:9: 16:16 ++ let mut _7: !; // in scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL + } bb0: { - StorageLive(_2); // scope 1 at $DIR/inline-diverging.rs:13:8: 13:13 - StorageLive(_3); // scope 1 at $DIR/inline-diverging.rs:13:8: 13:9 - _3 = _1; // scope 1 at $DIR/inline-diverging.rs:13:8: 13:9 - _2 = Gt(move _3, const 0_i32); // scope 1 at $DIR/inline-diverging.rs:13:8: 13:13 - StorageDead(_3); // scope 1 at $DIR/inline-diverging.rs:13:12: 13:13 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/inline-diverging.rs:13:8: 13:13 + StorageLive(_2); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 + StorageLive(_3); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:9 + _3 = _1; // scope 0 at $DIR/inline-diverging.rs:13:8: 13:9 + _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 + StorageDead(_3); // scope 0 at $DIR/inline-diverging.rs:13:12: 13:13 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 } bb1: { - StorageLive(_4); // scope 1 at $DIR/inline-diverging.rs:14:9: 14:10 - _4 = _1; // scope 1 at $DIR/inline-diverging.rs:14:9: 14:10 - _0 = move _4 as u32 (Misc); // scope 1 at $DIR/inline-diverging.rs:14:9: 14:17 - StorageDead(_4); // scope 1 at $DIR/inline-diverging.rs:14:16: 14:17 + StorageLive(_4); // scope 0 at $DIR/inline-diverging.rs:14:9: 14:10 + _4 = _1; // scope 0 at $DIR/inline-diverging.rs:14:9: 14:10 + _0 = move _4 as u32 (Misc); // scope 0 at $DIR/inline-diverging.rs:14:9: 14:17 + StorageDead(_4); // scope 0 at $DIR/inline-diverging.rs:14:16: 14:17 StorageDead(_2); // scope 0 at $DIR/inline-diverging.rs:17:5: 17:6 return; // scope 0 at $DIR/inline-diverging.rs:18:2: 18:2 } @@ -36,8 +34,8 @@ bb2: { StorageLive(_6); // scope 0 at $DIR/inline-diverging.rs:16:9: 16:16 - _6 = panic(); // scope 0 at $DIR/inline-diverging.rs:16:9: 16:16 -+ StorageLive(_7); // scope 2 at $SRC_DIR/std/src/panic.rs:LL:COL -+ _7 = begin_panic::<&str>(const "explicit panic"); // scope 2 at $SRC_DIR/std/src/panic.rs:LL:COL ++ StorageLive(_7); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL ++ _7 = begin_panic::<&str>(const "explicit panic"); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL // mir::Constant - // + span: $DIR/inline-diverging.rs:16:9: 16:14 - // + literal: Const { ty: fn() -> ! {panic}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/inline/inline_generator.main.Inline.diff b/src/test/mir-opt/inline/inline_generator.main.Inline.diff index af32b31580257..3e1c4a4670143 100644 --- a/src/test/mir-opt/inline/inline_generator.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_generator.main.Inline.diff @@ -33,8 +33,6 @@ + let mut _13: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41 + let mut _14: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41 + let mut _15: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41 -+ scope 7 { -+ } + } bb0: { @@ -106,13 +104,13 @@ + bb3: { + _11 = move _7; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41 + StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:15:17: 15:39 -+ StorageLive(_9); // scope 7 at $DIR/inline-generator.rs:15:20: 15:21 -+ _9 = _11; // scope 7 at $DIR/inline-generator.rs:15:20: 15:21 -+ switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 7 at $DIR/inline-generator.rs:15:20: 15:21 ++ StorageLive(_9); // scope 6 at $DIR/inline-generator.rs:15:20: 15:21 ++ _9 = _11; // scope 6 at $DIR/inline-generator.rs:15:20: 15:21 ++ switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline-generator.rs:15:20: 15:21 + } + + bb4: { -+ _8 = const 7_i32; // scope 7 at $DIR/inline-generator.rs:15:24: 15:25 ++ _8 = const 7_i32; // scope 6 at $DIR/inline-generator.rs:15:24: 15:25 + goto -> bb6; // scope 6 at $DIR/inline-generator.rs:15:17: 15:39 + } + diff --git a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index d4fe82cc99f67..a2471e4308b01 100644 --- a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -9,8 +9,6 @@ fn main() -> () { let mut _5: !; // in scope 0 at $DIR/issue-38669.rs:7:25: 9:10 scope 1 { debug should_break => _1; // in scope 1 at $DIR/issue-38669.rs:5:9: 5:25 - scope 2 { - } } bb0: { @@ -26,13 +24,13 @@ fn main() -> () { bb2: { StorageLive(_3); // scope 1 at $DIR/issue-38669.rs:7:9: 9:10 - StorageLive(_4); // scope 2 at $DIR/issue-38669.rs:7:12: 7:24 - _4 = _1; // scope 2 at $DIR/issue-38669.rs:7:12: 7:24 - switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/issue-38669.rs:7:12: 7:24 + StorageLive(_4); // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 + _4 = _1; // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 + switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 } bb3: { - _0 = const (); // scope 2 at $DIR/issue-38669.rs:8:13: 8:18 + _0 = const (); // scope 1 at $DIR/issue-38669.rs:8:13: 8:18 StorageDead(_4); // scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_3); // scope 1 at $DIR/issue-38669.rs:9:9: 9:10 StorageDead(_1); // scope 0 at $DIR/issue-38669.rs:12:1: 12:2 diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 7930aa9976864..ce7ca20358e12 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -15,10 +15,8 @@ fn main() -> () { scope 1 { debug e => _1; // in scope 1 at $DIR/issue-41888.rs:7:9: 7:10 scope 2 { - scope 3 { - debug _k => _6; // in scope 3 at $DIR/issue-41888.rs:10:21: 10:23 - let _6: K; // in scope 3 at $DIR/issue-41888.rs:10:21: 10:23 - } + debug _k => _6; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + let _6: K; // in scope 2 at $DIR/issue-41888.rs:10:21: 10:23 } } @@ -27,48 +25,48 @@ fn main() -> () { _7 = const false; // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 _8 = const false; // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 StorageLive(_1); // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 - StorageLive(_2); // scope 2 at $DIR/issue-41888.rs:8:8: 8:14 - _2 = cond() -> [return: bb1, unwind: bb11]; // scope 2 at $DIR/issue-41888.rs:8:8: 8:14 + StorageLive(_2); // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 + _2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 // mir::Constant // + span: $DIR/issue-41888.rs:8:8: 8:12 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar()) } } bb1: { - switchInt(move _2) -> [false: bb7, otherwise: bb2]; // scope 2 at $DIR/issue-41888.rs:8:8: 8:14 + switchInt(move _2) -> [false: bb7, otherwise: bb2]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 } bb2: { - StorageLive(_3); // scope 2 at $DIR/issue-41888.rs:9:13: 9:20 - StorageLive(_4); // scope 2 at $DIR/issue-41888.rs:9:18: 9:19 - _4 = K; // scope 2 at $DIR/issue-41888.rs:9:18: 9:19 - _3 = E::F(move _4); // scope 2 at $DIR/issue-41888.rs:9:13: 9:20 - StorageDead(_4); // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 - goto -> bb14; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + StorageLive(_3); // scope 1 at $DIR/issue-41888.rs:9:13: 9:20 + StorageLive(_4); // scope 1 at $DIR/issue-41888.rs:9:18: 9:19 + _4 = K; // scope 1 at $DIR/issue-41888.rs:9:18: 9:19 + _3 = E::F(move _4); // scope 1 at $DIR/issue-41888.rs:9:13: 9:20 + StorageDead(_4); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + goto -> bb14; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 } bb3: { - goto -> bb4; // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 + goto -> bb4; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 } bb4: { - StorageDead(_3); // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 3 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 3 at $DIR/issue-41888.rs:10:16: 10:24 + StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + _5 = discriminant(_1); // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 2 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageLive(_6); // scope 3 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 3 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 3 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = const (); // scope 3 at $DIR/issue-41888.rs:10:29: 13:10 - StorageDead(_6); // scope 2 at $DIR/issue-41888.rs:13:9: 13:10 - goto -> bb8; // scope 2 at $DIR/issue-41888.rs:10:9: 13:10 + StorageLive(_6); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 2 at $DIR/issue-41888.rs:10:21: 10:23 + _0 = const (); // scope 2 at $DIR/issue-41888.rs:10:29: 13:10 + StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 + goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } bb6: { - _0 = const (); // scope 2 at $DIR/issue-41888.rs:13:10: 13:10 - goto -> bb8; // scope 2 at $DIR/issue-41888.rs:10:9: 13:10 + _0 = const (); // scope 1 at $DIR/issue-41888.rs:13:10: 13:10 + goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } bb7: { @@ -90,7 +88,7 @@ fn main() -> () { } bb10 (cleanup): { - goto -> bb11; // scope 2 at $DIR/issue-41888.rs:9:19: 9:20 + goto -> bb11; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 } bb11 (cleanup): { @@ -102,19 +100,19 @@ fn main() -> () { } bb13 (cleanup): { - _7 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - _8 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - _9 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - _1 = move _3; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - goto -> bb10; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb10; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 } bb14: { - _7 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - _8 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - _9 = const true; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - _1 = move _3; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 - goto -> bb3; // scope 2 at $DIR/issue-41888.rs:9:9: 9:10 + _7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + _1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 } bb15: { diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 52a4cc661a52d..8b0a73ec4ba61 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -29,11 +29,9 @@ scope 4 { debug left_val => _8; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _13: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - let _13: core::panicking::AssertKind; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 { - debug kind => _13; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } + debug kind => _13; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -72,32 +70,32 @@ _8 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _9 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_10); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_11); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = (*_8); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = Eq(move _12, const 1_i32); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_12); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = Not(move _11); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_11); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _10) -> [false: bb2, otherwise: bb1]; // scope 5 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 + 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 + _11 = Eq(move _12, const 1_i32); // 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 = Not(move _11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _10) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_14); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = _8; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = _16; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_17); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_18); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = _9; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = _18; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_19); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_19); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_19) = 0; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _14 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = _8; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = _16; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_19) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _14 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index 877c03d65cf9f..c96a6641bab91 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -37,11 +37,9 @@ scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _20: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - let _20: core::panicking::AssertKind; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 6 { - debug kind => _20; // in scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } + debug kind => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -99,42 +97,42 @@ _13 = (_9.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _14 = (_9.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = (*_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = const 1_i32; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = Eq(move _17, const 1_i32); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = Not(move _16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _15) -> [false: bb4, otherwise: bb3]; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + 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 = const 1_i32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = Eq(move _17, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + 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 + StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _15) -> [false: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { - StorageLive(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_20); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_20) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_21); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = const core::panicking::AssertKind::Eq; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_20) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = const core::panicking::AssertKind::Eq; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } - StorageLive(_23); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _13; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _24; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _26 = _14; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = _26; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_27); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_27); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_27) = 0; // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 6 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = _13; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = _24; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_26); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _26 = _14; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = _26; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Deinit(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_27) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 1dca68fd72790..40e7b74453a7c 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -8,62 +8,60 @@ fn num_to_digit(_1: char) -> u32 { let mut _4: char; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29 let mut _5: u32; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 let mut _12: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 1 { - scope 2 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 - debug self => _2; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - debug radix => _5; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let mut _6: &std::option::Option; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let _7: std::option::Option; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let mut _8: char; // in scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - scope 3 (inlined Option::::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL - debug self => _6; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _9: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - } + scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 + debug self => _2; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug radix => _5; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let mut _6: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let _7: std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let mut _8: char; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + scope 2 (inlined Option::::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug self => _6; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _9: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL } - scope 4 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 - debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _10: isize; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _11: !; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL - scope 5 { - debug val => _0; // in scope 5 at $SRC_DIR/core/src/option.rs:LL:COL - } + } + scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 + debug self => _3; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _10: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _11: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + scope 4 { + debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL } } bb0: { - StorageLive(_2); // scope 1 at $DIR/issue-59352.rs:14:8: 14:11 - _2 = _1; // scope 1 at $DIR/issue-59352.rs:14:8: 14:11 - StorageLive(_5); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_6); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_7); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_8); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _8 = _2; // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 + _2 = _1; // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 + StorageLive(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value(Scalar()) } } bb1: { - StorageDead(_12); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_3); // scope 1 at $DIR/issue-59352.rs:14:26: 14:41 - StorageLive(_4); // scope 1 at $DIR/issue-59352.rs:14:26: 14:29 - _4 = _1; // scope 1 at $DIR/issue-59352.rs:14:26: 14:29 - _3 = char::methods::::to_digit(move _4, const 8_u32) -> bb2; // scope 1 at $DIR/issue-59352.rs:14:26: 14:41 + StorageDead(_12); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 + StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 + _4 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 + _3 = char::methods::::to_digit(move _4, const 8_u32) -> bb2; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 // mir::Constant // + span: $DIR/issue-59352.rs:14:30: 14:38 // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value(Scalar()) } } bb2: { - StorageDead(_4); // scope 1 at $DIR/issue-59352.rs:14:40: 14:41 - StorageLive(_10); // scope 1 at $DIR/issue-59352.rs:14:26: 14:50 - _10 = discriminant(_3); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 + StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + _10 = discriminant(_3); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } bb3: { - StorageDead(_12); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_12); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } @@ -73,23 +71,23 @@ fn num_to_digit(_1: char) -> u32 { } bb5: { - _6 = &_7; // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_8); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_9); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _9 = discriminant((*_6)); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - StorageLive(_12); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = move _9; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_9); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_6); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_7); // scope 2 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_5); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - StorageDead(_2); // scope 1 at $DIR/issue-59352.rs:14:22: 14:23 - switchInt(move _12) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _6 = &_7; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_8); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_9); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _9 = discriminant((*_6)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + StorageLive(_12); // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = move _9; // scope 2 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_7); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:22: 14:23 + switchInt(move _12) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 } bb6: { - StorageLive(_11); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL - _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + StorageLive(_11); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/option.rs:LL:COL // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value(Scalar()) } @@ -99,13 +97,13 @@ fn num_to_digit(_1: char) -> u32 { } bb7: { - unreachable; // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + unreachable; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } bb8: { - _0 = move ((_3 as Some).0: u32); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_10); // scope 1 at $DIR/issue-59352.rs:14:26: 14:50 - StorageDead(_3); // scope 1 at $DIR/issue-59352.rs:14:49: 14:50 + _0 = move ((_3 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } } diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index d39bb419e3ff5..9e91603cee943 100644 --- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -9,20 +9,18 @@ fn main() -> () { let mut _5: (); // in scope 0 at $DIR/loop_test.rs:6:1: 17:2 let _6: i32; // in scope 0 at $DIR/loop_test.rs:14:13: 14:14 scope 1 { - } - scope 2 { - debug x => _6; // in scope 2 at $DIR/loop_test.rs:14:13: 14:14 + debug x => _6; // in scope 1 at $DIR/loop_test.rs:14:13: 14:14 } bb0: { StorageLive(_1); // scope 0 at $DIR/loop_test.rs:10:5: 12:6 - StorageLive(_2); // scope 1 at $DIR/loop_test.rs:10:8: 10:12 - _2 = const true; // scope 1 at $DIR/loop_test.rs:10:8: 10:12 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/loop_test.rs:10:8: 10:12 + StorageLive(_2); // scope 0 at $DIR/loop_test.rs:10:8: 10:12 + _2 = const true; // scope 0 at $DIR/loop_test.rs:10:8: 10:12 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:10:8: 10:12 } bb1: { - _0 = const (); // scope 1 at $DIR/loop_test.rs:11:9: 11:15 + _0 = const (); // scope 0 at $DIR/loop_test.rs:11:9: 11:15 StorageDead(_2); // scope 0 at $DIR/loop_test.rs:12:5: 12:6 StorageDead(_1); // scope 0 at $DIR/loop_test.rs:12:5: 12:6 return; // scope 0 at $DIR/loop_test.rs:17:2: 17:2 diff --git a/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff b/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff index e2cc076c6d8d1..c7226573d75c5 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.InstCombine.diff @@ -13,45 +13,43 @@ let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - scope 1 { - let mut _11: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - } + let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 - _4 = _1; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 - StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _7 = _2; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - _11 = _7; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:7:20: 7:21 -- _5 = Len((*_11)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _5 = const N; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _7 = _2; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + _11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 +- _5 = Len((*_11)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 } bb1: { - StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 - _8 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 -- _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -+ _9 = const N; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 - _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 + _8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 +- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 ++ _9 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 } bb2: { - _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 - StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 + _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 goto -> bb4; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff b/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff index d1cd3865da327..d6c1c92cd9177 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.diff @@ -13,47 +13,45 @@ let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - scope 1 { -+ let mut _11: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - } ++ let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 - _4 = _1; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 - StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -+ StorageLive(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _11 = _7; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:7:20: 7:21 -- _5 = Len((*_6)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -+ _5 = Len((*_11)); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -+ StorageDead(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - goto -> bb1; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 ++ StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _11 = _7; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 +- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 ++ _5 = Len((*_11)); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 ++ StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 } bb1: { - StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 } bb2: { - StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 - _8 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 - _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 - _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 + _8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 + _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 } bb3: { - _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 - StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 + _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff index 3d7047b71d342..887c7b01f4327 100644 --- a/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_bound.SimplifyLocals.diff @@ -13,49 +13,47 @@ - let _8: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 - let mut _9: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - let mut _10: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 +- let mut _11: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 + let _6: usize; // in scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 + let mut _7: usize; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 + let mut _8: bool; // in scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 - scope 1 { -- let mut _11: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 - } bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 - _4 = _1; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:13 - StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageLive(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:7:20: 7:21 - _5 = const N; // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageDead(_11); // scope 1 at $DIR/lower_array_len.rs:7:16: 7:27 -- StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 - StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:7:26: 7:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageLive(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:7:20: 7:21 + _5 = const N; // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageDead(_11); // scope 0 at $DIR/lower_array_len.rs:7:16: 7:27 +- StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:7:26: 7:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:7:8: 7:27 } bb1: { -- StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 -- _8 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 -- _9 = const N; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -- _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -+ StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 -+ _6 = _1; // scope 1 at $DIR/lower_array_len.rs:8:15: 8:20 -+ _7 = const N; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -+ _8 = Lt(_6, _7); // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 +- StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 +- _8 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 +- _9 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 +- _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 ++ StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 ++ _6 = _1; // scope 0 at $DIR/lower_array_len.rs:8:15: 8:20 ++ _7 = const N; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 ++ _8 = Lt(_6, _7); // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 ++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 } bb2: { -- _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -- StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 -+ _0 = (*_2)[_6]; // scope 1 at $DIR/lower_array_len.rs:8:9: 8:21 -+ StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:9:5: 9:6 +- _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 +- StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 ++ _0 = (*_2)[_6]; // scope 0 at $DIR/lower_array_len.rs:8:9: 8:21 ++ StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:9:5: 9:6 goto -> bb4; // scope 0 at $DIR/lower_array_len.rs:7:5: 11:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff index ef5641ad34335..5622d48453213 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.InstCombine.diff @@ -16,44 +16,42 @@ let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 - scope 1 { - let mut _14: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - } + let mut _14: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 - _4 = _1; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 - StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - _14 = _7; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:18:20: 18:21 -- _5 = Len((*_14)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -+ _5 = const N; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + _14 = _7; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 +- _5 = Len((*_14)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 ++ _5 = const N; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 } bb1: { - StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 - _8 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 -- _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -+ _9 = const N; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 - _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 + _8 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 +- _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 ++ _9 = const N; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 } bb2: { - _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 - StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 + _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:18:5: 24:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff index c31c9d80a1bf3..11fc20aa693c7 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.diff @@ -16,47 +16,45 @@ let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 - scope 1 { -+ let mut _14: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - } ++ let mut _14: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 - _4 = _1; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 - StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - _7 = &(*_2); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -+ StorageLive(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -+ _14 = _7; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:18:20: 18:21 -- _5 = Len((*_6)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -+ _5 = Len((*_14)); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -+ StorageDead(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - goto -> bb1; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + _7 = &(*_2); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 ++ StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 ++ _14 = _7; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + _6 = move _7 as &[u8] (Pointer(Unsize)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 +- _5 = Len((*_6)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 ++ _5 = Len((*_14)); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 ++ StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + goto -> bb1; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 } bb1: { - StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 } bb2: { - StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 - _8 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 - _9 = Len((*_2)); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 - _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 + _8 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 + _9 = Len((*_2)); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 } bb3: { - _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 - StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 + _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 goto -> bb6; // scope 0 at $DIR/lower_array_len.rs:18:5: 24:6 } diff --git a/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff b/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff index a3d794f94b3f2..51d5f1acdab83 100644 --- a/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff +++ b/src/test/mir-opt/lower_array_len.array_bound_mut.SimplifyLocals.diff @@ -16,52 +16,50 @@ - let _11: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 - let mut _12: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 - let mut _13: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 +- let mut _14: &[u8; N]; // in scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 + let _6: usize; // in scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 + let mut _7: usize; // in scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + let mut _8: bool; // in scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 + let _9: usize; // in scope 0 at $DIR/lower_array_len.rs:21:15: 21:16 + let mut _10: usize; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 + let mut _11: bool; // in scope 0 at $DIR/lower_array_len.rs:21:9: 21:17 - scope 1 { -- let mut _14: &[u8; N]; // in scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 - } bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageLive(_4); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 - _4 = _1; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:13 - StorageLive(_5); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageLive(_7); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageLive(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageDead(_7); // scope 1 at $DIR/lower_array_len.rs:18:20: 18:21 - _5 = const N; // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageDead(_14); // scope 1 at $DIR/lower_array_len.rs:18:16: 18:27 -- StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 - StorageDead(_5); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - StorageDead(_4); // scope 1 at $DIR/lower_array_len.rs:18:26: 18:27 - switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_3); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageLive(_4); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 + _4 = _1; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:13 + StorageLive(_5); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageLive(_7); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageLive(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageDead(_7); // scope 0 at $DIR/lower_array_len.rs:18:20: 18:21 + _5 = const N; // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageDead(_14); // scope 0 at $DIR/lower_array_len.rs:18:16: 18:27 +- StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 + StorageDead(_5); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + StorageDead(_4); // scope 0 at $DIR/lower_array_len.rs:18:26: 18:27 + switchInt(move _3) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/lower_array_len.rs:18:8: 18:27 } bb1: { -- StorageLive(_8); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 -- _8 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 -- _9 = const N; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -- _10 = Lt(_8, _9); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -+ StorageLive(_6); // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 -+ _6 = _1; // scope 1 at $DIR/lower_array_len.rs:19:15: 19:20 -+ _7 = const N; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -+ _8 = Lt(_6, _7); // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 +- StorageLive(_8); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 +- _8 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 +- _9 = const N; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 +- _10 = Lt(_8, _9); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb2; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 ++ StorageLive(_6); // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 ++ _6 = _1; // scope 0 at $DIR/lower_array_len.rs:19:15: 19:20 ++ _7 = const N; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 ++ _8 = Lt(_6, _7); // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 ++ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb2; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 } bb2: { -- _0 = (*_2)[_8]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -- StorageDead(_8); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 -+ _0 = (*_2)[_6]; // scope 1 at $DIR/lower_array_len.rs:19:9: 19:21 -+ StorageDead(_6); // scope 1 at $DIR/lower_array_len.rs:20:5: 20:6 +- _0 = (*_2)[_8]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 +- StorageDead(_8); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 ++ _0 = (*_2)[_6]; // scope 0 at $DIR/lower_array_len.rs:19:9: 19:21 ++ StorageDead(_6); // scope 0 at $DIR/lower_array_len.rs:20:5: 20:6 goto -> bb5; // scope 0 at $DIR/lower_array_len.rs:18:5: 24:6 } diff --git a/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir b/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir index 4b77db0707d3f..7750624db30fb 100644 --- a/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir +++ b/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir @@ -7,9 +7,7 @@ fn f_u64() -> () { debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:44:22: 44:23 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:48:9: 48:21 let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:48:19: 48:20 - scope 2 { - scope 3 (inlined std::mem::size_of::) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 - } + scope 2 (inlined std::mem::size_of::) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 } } diff --git a/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir b/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir index 1306caf229174..4d4e65d311416 100644 --- a/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir +++ b/src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir @@ -6,23 +6,21 @@ fn f_unit() -> () { scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19 debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:44:22: 44:23 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:46:9: 46:17 - scope 2 { - scope 3 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 - } + scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:45:8: 45:32 } } bb0: { StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18 - StorageLive(_2); // scope 2 at $DIR/lower_intrinsics.rs:46:9: 46:17 - _2 = f_zst::<()>(const ()) -> bb1; // scope 2 at $DIR/lower_intrinsics.rs:46:9: 46:17 + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:46:9: 46:17 + _2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:46:9: 46:17 // mir::Constant // + span: $DIR/lower_intrinsics.rs:46:9: 46:14 // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(Scalar()) } } bb1: { - StorageDead(_2); // scope 2 at $DIR/lower_intrinsics.rs:46:17: 46:18 + StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:46:17: 46:18 StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:18: 34:19 return; // scope 0 at $DIR/lower_intrinsics.rs:35:2: 35:2 } diff --git a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff index 095641a597ba8..13241d882f210 100644 --- a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff +++ b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -12,43 +12,41 @@ let _7: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 let mut _8: usize; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 let mut _9: bool; // in scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 - scope 1 { - } bb0: { - StorageLive(_3); // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:27 - StorageLive(_4); // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:13 - _4 = _1; // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:13 - StorageLive(_5); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 - StorageLive(_6); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 - _6 = &(*_2); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 -- _5 = core::slice::::len(move _6) -> bb1; // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 + StorageLive(_3); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageLive(_4); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 + _4 = _1; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:13 + StorageLive(_5); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 + StorageLive(_6); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 + _6 = &(*_2); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 +- _5 = core::slice::::len(move _6) -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 - // mir::Constant - // + span: $DIR/lower_slice_len.rs:5:22: 5:25 - // + literal: Const { ty: for<'r> fn(&'r [u8]) -> usize {core::slice::::len}, val: Value(Scalar()) } -+ _5 = Len((*_6)); // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 -+ goto -> bb1; // scope 1 at $DIR/lower_slice_len.rs:5:16: 5:27 ++ _5 = Len((*_6)); // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 ++ goto -> bb1; // scope 0 at $DIR/lower_slice_len.rs:5:16: 5:27 } bb1: { - StorageDead(_6); // scope 1 at $DIR/lower_slice_len.rs:5:26: 5:27 - _3 = Lt(move _4, move _5); // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:27 - StorageDead(_5); // scope 1 at $DIR/lower_slice_len.rs:5:26: 5:27 - StorageDead(_4); // scope 1 at $DIR/lower_slice_len.rs:5:26: 5:27 - switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 1 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageDead(_6); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 + _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 + StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 + StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 } bb2: { - StorageLive(_7); // scope 1 at $DIR/lower_slice_len.rs:6:15: 6:20 - _7 = _1; // scope 1 at $DIR/lower_slice_len.rs:6:15: 6:20 - _8 = Len((*_2)); // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 - _9 = Lt(_7, _8); // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 + StorageLive(_7); // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 + _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 + _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + _9 = Lt(_7, _8); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 } bb3: { - _0 = (*_2)[_7]; // scope 1 at $DIR/lower_slice_len.rs:6:9: 6:21 - StorageDead(_7); // scope 1 at $DIR/lower_slice_len.rs:7:5: 7:6 + _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:7:5: 7:6 goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 } diff --git a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 72fd303d447d1..c2e422f800250 100644 --- a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -26,12 +26,8 @@ debug s => _8; // in scope 1 at $DIR/match-arm-scopes.rs:15:20: 15:21 } scope 2 { - } - scope 3 { - } - scope 4 { - debug b => _15; // in scope 4 at $DIR/match-arm-scopes.rs:16:16: 16:17 - debug t => _16; // in scope 4 at $DIR/match-arm-scopes.rs:16:19: 16:20 + debug b => _15; // in scope 2 at $DIR/match-arm-scopes.rs:16:16: 16:17 + debug t => _16; // in scope 2 at $DIR/match-arm-scopes.rs:16:19: 16:20 } bb0: { @@ -87,15 +83,15 @@ - _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 - _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 StorageLive(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 - StorageLive(_10); // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 - _10 = _1; // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 -- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 -+ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 2 at $DIR/match-arm-scopes.rs:15:45: 15:49 + StorageLive(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 + _10 = _1; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 +- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 ++ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 } - bb9: { + bb6: { - _0 = const 3_i32; // scope 2 at $DIR/match-arm-scopes.rs:15:59: 15:60 + _0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60 StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - goto -> bb23; // scope 0 at no-location @@ -144,15 +140,15 @@ - _3 = &shallow (_2.0: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 - _4 = &shallow (_2.1: bool); // scope 0 at $DIR/match-arm-scopes.rs:14:11: 14:16 StorageLive(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 - StorageLive(_13); // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 - _13 = _1; // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 -- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 -+ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 3 at $DIR/match-arm-scopes.rs:15:45: 15:49 + StorageLive(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 + _13 = _1; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 +- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 ++ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 } - bb14: { + bb11: { - _0 = const 3_i32; // scope 3 at $DIR/match-arm-scopes.rs:15:59: 15:60 + _0 = const 3_i32; // scope 0 at $DIR/match-arm-scopes.rs:15:59: 15:60 StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - goto -> bb23; // scope 0 at no-location @@ -204,7 +200,7 @@ - bb19: { + bb16: { - _0 = const 2_i32; // scope 4 at $DIR/match-arm-scopes.rs:16:41: 16:42 + _0 = const 2_i32; // scope 2 at $DIR/match-arm-scopes.rs:16:41: 16:42 - drop(_16) -> [return: bb21, unwind: bb25]; // scope 0 at $DIR/match-arm-scopes.rs:16:41: 16:42 + drop(_16) -> [return: bb18, unwind: bb22]; // scope 0 at $DIR/match-arm-scopes.rs:16:41: 16:42 } diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff index 7736342316b59..29f66ceac981e 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff @@ -6,26 +6,24 @@ let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25 let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26 + let mut _3: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 1 { - } bb0: { - _2 = discriminant(_1); // scope 1 at $DIR/matches_reduce_branches.rs:8:17: 8:20 -- switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:17: 8:20 +- switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb1: { -- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb2: { -- goto -> bb3; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL +- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb3: { -+ StorageLive(_3); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _3 = move _2; // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ StorageDead(_3); // scope 1 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ StorageLive(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ _3 = move _2; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ StorageDead(_3); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2 } } diff --git a/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir b/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir index 4cac6a007f3b3..e3b318c949fc6 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir +++ b/src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir @@ -3,8 +3,6 @@ fn foo(_1: Option<()>) -> () { debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11 let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25 - scope 1 { - } bb0: { return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2 diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff index 95ce545bbd412..2dfb2e1af0d63 100644 --- a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff +++ b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff @@ -9,37 +9,31 @@ scope 1 { debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:40:9: 40:12 } - scope 2 { - scope 3 { - scope 4 { - } - } - } bb0: { StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12 - StorageLive(_2); // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + _2 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - } - - bb1: { -+ StorageLive(_3); // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -+ _3 = move _2; // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - StorageDead(_2); // scope 3 at $DIR/matches_reduce_branches.rs:41:51: 41:52 ++ StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ _3 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 - _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 - } - - bb2: { -- StorageDead(_2); // scope 3 at $DIR/matches_reduce_branches.rs:41:51: 41:52 +- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 - _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 - } - - bb3: { + _1 = Ne(_3, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 -+ StorageDead(_3); // scope 4 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 _0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:51:5: 51:8 StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:52:1: 52:2 return; // scope 0 at $DIR/matches_reduce_branches.rs:52:2: 52:2 diff --git a/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff b/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff index 23a388aadde71..dbcb8813d5458 100644 --- a/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff +++ b/src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff @@ -4,8 +4,6 @@ fn test(_1: bool) -> () { debug x => _1; // in scope 0 at $DIR/multiple_return_terminators.rs:4:9: 4:10 let mut _0: (); // return place in scope 0 at $DIR/multiple_return_terminators.rs:4:18: 4:18 - scope 1 { - } bb0: { return; // scope 0 at $DIR/multiple_return_terminators.rs:10:2: 10:2 diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 4a0a7b24aa3d9..162cacef8a54a 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -39,8 +39,6 @@ fn main() -> () { let _6: &'_#5r usize; // in scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 scope 3 { debug q => _6; // in scope 3 at $DIR/region-subtyping-basic.rs:19:9: 19:10 - scope 4 { - } } } } @@ -63,25 +61,25 @@ fn main() -> () { StorageLive(_6); // bb1[2]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 _6 = _2; // bb1[3]: scope 2 at $DIR/region-subtyping-basic.rs:19:13: 19:14 FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 - StorageLive(_7); // bb1[5]: scope 4 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 4 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 4 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + _7 = const ConstValue(Scalar(0x01): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 + switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 } bb2: { - StorageLive(_8); // bb2[0]: scope 4 at $DIR/region-subtyping-basic.rs:21:9: 21:18 - StorageLive(_9); // bb2[1]: scope 4 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _9 = (*_6); // bb2[2]: scope 4 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _8 = ConstValue(Scalar(): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 4 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 + _9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 + _8 = ConstValue(Scalar(): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 // mir::Constant // + span: $DIR/region-subtyping-basic.rs:21:9: 21:14 // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar()) } } bb3: { - StorageDead(_9); // bb3[0]: scope 4 at $DIR/region-subtyping-basic.rs:21:17: 21:18 - StorageDead(_8); // bb3[1]: scope 4 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = const ConstValue(Scalar(): ()); // bb3[2]: scope 4 at $DIR/region-subtyping-basic.rs:20:13: 22:6 + StorageDead(_9); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 + StorageDead(_8); // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 + _0 = const ConstValue(Scalar(): ()); // bb3[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 goto -> bb6; // bb3[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } diff --git a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff index 349dbbb2679d2..249db1c8a5ab2 100644 --- a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff +++ b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff @@ -6,21 +6,19 @@ let mut _0: u32; // return place in scope 0 at $DIR/not_equal_false.rs:3:20: 3:23 let mut _2: bool; // in scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 let mut _3: bool; // in scope 0 at $DIR/not_equal_false.rs:4:8: 4:9 - scope 1 { - } bb0: { - StorageLive(_2); // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 - StorageLive(_3); // scope 1 at $DIR/not_equal_false.rs:4:8: 4:9 - _3 = _1; // scope 1 at $DIR/not_equal_false.rs:4:8: 4:9 -- _2 = Ne(move _3, const false); // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 -+ _2 = move _3; // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 - StorageDead(_3); // scope 1 at $DIR/not_equal_false.rs:4:17: 4:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 1 at $DIR/not_equal_false.rs:4:8: 4:18 + StorageLive(_2); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 + StorageLive(_3); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:9 + _3 = _1; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:9 +- _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 ++ _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 + StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:18 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 } bb1: { - _0 = const 0_u32; // scope 1 at $DIR/not_equal_false.rs:4:21: 4:22 + _0 = const 0_u32; // scope 0 at $DIR/not_equal_false.rs:4:21: 4:22 goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:35 } diff --git a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir index c1fe50afff2e5..69742d6bc3b6a 100644 --- a/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.mir @@ -51,11 +51,9 @@ fn array_casts() -> () { scope 7 { debug left_val => _20; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _21; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _27: core::panicking::AssertKind; // in scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 8 { - let _27: core::panicking::AssertKind; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 9 { - debug kind => _27; // in scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } + debug kind => _27; // in scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -139,41 +137,41 @@ fn array_casts() -> () { StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _21 = (_13.1: &usize); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL Retag(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_23); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = (*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = (*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = Eq(move _24, move _25); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_25); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_24); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = Not(move _23); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_23); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _22) -> [false: bb4, otherwise: bb3]; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _24 = (*_20); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = (*_21); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _23 = Eq(move _24, move _25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _22 = Not(move _23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _22) -> [false: bb4, otherwise: bb3]; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { - StorageLive(_27); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _27 = core::panicking::AssertKind::Eq; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_28); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_29); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _29 = move _27; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_30); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_31); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _31 = &(*_20); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_31); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _30 = &(*_31); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_30); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_32); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_33); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _33 = &(*_21); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_33); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _32 = &(*_33); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Retag(_32); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_34); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _34 = Option::::None; // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _28 = core::panicking::assert_failed::(move _29, move _30, move _32, move _34); // scope 9 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_27); // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _27 = core::panicking::AssertKind::Eq; // scope 7 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_28); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_29); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _29 = move _27; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _31 = &(*_20); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _30 = &(*_31); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_30); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _33 = &(*_21); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _32 = &(*_33); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + Retag(_32); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _34 = Option::::None; // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _28 = core::panicking::assert_failed::(move _29, move _30, move _32, move _34); // scope 8 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r usize, &'s usize, Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff index 06c4b997c7c33..1c5a890023648 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff @@ -6,8 +6,6 @@ let mut _1: (); // in scope 0 at $DIR/simplify_cfg.rs:7:1: 13:2 let mut _2: bool; // in scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 let mut _3: !; // in scope 0 at $DIR/simplify_cfg.rs:9:18: 11:10 - scope 1 { - } bb0: { goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 @@ -18,23 +16,23 @@ - } - - bb2: { - StorageLive(_2); // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 -- _2 = bar() -> [return: bb3, unwind: bb6]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 -+ _2 = bar() -> [return: bb2, unwind: bb5]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 + StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 +- _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 ++ _2 = bar() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 // mir::Constant // + span: $DIR/simplify_cfg.rs:9:12: 9:15 // + literal: Const { ty: fn() -> bool {bar}, val: Value(Scalar()) } } - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 +- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + bb2: { -+ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 ++ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 } - bb4: { + bb3: { - _0 = const (); // scope 1 at $DIR/simplify_cfg.rs:10:13: 10:18 + _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 return; // scope 0 at $DIR/simplify_cfg.rs:13:2: 13:2 } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff index ed2bda1a47491..b079bd7b57c42 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff @@ -6,8 +6,6 @@ let mut _1: (); // in scope 0 at $DIR/simplify_cfg.rs:7:1: 13:2 let mut _2: bool; // in scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 let mut _3: !; // in scope 0 at $DIR/simplify_cfg.rs:9:18: 11:10 - scope 1 { - } bb0: { goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 @@ -19,31 +17,31 @@ } bb2: { - StorageLive(_2); // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 -- _2 = bar() -> [return: bb3, unwind: bb11]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 -+ _2 = bar() -> [return: bb3, unwind: bb6]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 + StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 +- _2 = bar() -> [return: bb3, unwind: bb11]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 ++ _2 = bar() -> [return: bb3, unwind: bb6]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 // mir::Constant // + span: $DIR/simplify_cfg.rs:9:12: 9:15 // + literal: Const { ty: fn() -> bool {bar}, val: Value(Scalar()) } } bb3: { - switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 + switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 } bb4: { - _0 = const (); // scope 1 at $DIR/simplify_cfg.rs:10:13: 10:18 -- goto -> bb10; // scope 1 at $DIR/simplify_cfg.rs:10:13: 10:18 + _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 +- goto -> bb10; // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 + StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 + return; // scope 0 at $DIR/simplify_cfg.rs:13:2: 13:2 } bb5: { -- goto -> bb8; // scope 1 at $DIR/simplify_cfg.rs:9:12: 9:17 +- goto -> bb8; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 - } - - bb6: { -- unreachable; // scope 1 at $DIR/simplify_cfg.rs:9:18: 11:10 +- unreachable; // scope 0 at $DIR/simplify_cfg.rs:9:18: 11:10 - } - - bb7: { diff --git a/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff b/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff index 2f9e45279d86e..d11c70b1efec6 100644 --- a/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff +++ b/src/test/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.diff @@ -5,27 +5,25 @@ let mut _0: (); // return place in scope 0 at $DIR/simplify_if.rs:5:11: 5:11 let mut _1: bool; // in scope 0 at $DIR/simplify_if.rs:6:8: 6:13 let _2: (); // in scope 0 at $DIR/simplify_if.rs:7:9: 7:15 - scope 1 { - } bb0: { - StorageLive(_1); // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 - _1 = const false; // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 -- switchInt(const false) -> [false: bb3, otherwise: bb1]; // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 -+ goto -> bb3; // scope 1 at $DIR/simplify_if.rs:6:8: 6:13 + StorageLive(_1); // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 + _1 = const false; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 +- switchInt(const false) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 ++ goto -> bb3; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 } bb1: { - StorageLive(_2); // scope 1 at $DIR/simplify_if.rs:7:9: 7:15 - _2 = noop() -> bb2; // scope 1 at $DIR/simplify_if.rs:7:9: 7:15 + StorageLive(_2); // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 + _2 = noop() -> bb2; // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 // mir::Constant // + span: $DIR/simplify_if.rs:7:9: 7:13 // + literal: Const { ty: fn() {noop}, val: Value(Scalar()) } } bb2: { - StorageDead(_2); // scope 1 at $DIR/simplify_if.rs:7:15: 7:16 - nop; // scope 1 at $DIR/simplify_if.rs:6:14: 8:6 + StorageDead(_2); // scope 0 at $DIR/simplify_if.rs:7:15: 7:16 + nop; // scope 0 at $DIR/simplify_if.rs:6:14: 8:6 goto -> bb4; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index d220d92902098..075fe8d090829 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -13,8 +13,6 @@ scope 1 { debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 let _6: u8; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 - scope 2 { - } } bb0: { @@ -42,11 +40,11 @@ bb2: { StorageLive(_6); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 _6 = (((_1.0: std::option::Option) as Some).0: u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19 -- StorageLive(_7); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageLive(_8); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _8 = _6; // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 -- _7 = Gt(move _8, const 42_u8); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 -- StorageDead(_8); // scope 2 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 +- StorageLive(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageLive(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _8 = _6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13 +- _7 = Gt(move _8, const 42_u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 +- StorageDead(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 - StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index e87c59a4c7708..70486f546d71b 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -14,8 +14,6 @@ let mut _4: i32; // in scope 1 at $DIR/unreachable.rs:10:13: 10:19 scope 2 { debug _y => _4; // in scope 2 at $DIR/unreachable.rs:10:13: 10:19 - scope 3 { - } } } @@ -38,14 +36,14 @@ - _3 = move ((_1 as Some).0: Empty); // scope 1 at $DIR/unreachable.rs:9:17: 9:19 - StorageLive(_4); // scope 1 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 -- StorageLive(_6); // scope 3 at $DIR/unreachable.rs:12:12: 12:16 -- _6 = const true; // scope 3 at $DIR/unreachable.rs:12:12: 12:16 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 3 at $DIR/unreachable.rs:12:12: 12:16 +- StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 +- _6 = const true; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 - } - - bb3: { -- _4 = const 21_i32; // scope 3 at $DIR/unreachable.rs:13:13: 13:20 -- _5 = const (); // scope 3 at $DIR/unreachable.rs:12:17: 14:10 +- _4 = const 21_i32; // scope 2 at $DIR/unreachable.rs:13:13: 13:20 +- _5 = const (); // scope 2 at $DIR/unreachable.rs:12:17: 14:10 - goto -> bb5; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - } - diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index b63a2f2b0ac4d..d9f2681d145e6 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -14,8 +14,6 @@ scope 2 { debug bomb => _4; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 let _4: Empty; // in scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 - scope 3 { - } } } @@ -39,15 +37,15 @@ StorageLive(_4); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 _4 = move ((_2 as Some).0: Empty); // scope 2 at $DIR/unreachable_diverging.rs:14:17: 14:21 StorageLive(_5); // scope 2 at $DIR/unreachable_diverging.rs:15:9: 17:10 - StorageLive(_6); // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 - _6 = _1; // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 -- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 -+ goto -> bb3; // scope 3 at $DIR/unreachable_diverging.rs:15:12: 15:13 + StorageLive(_6); // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 + _6 = _1; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 ++ goto -> bb3; // scope 2 at $DIR/unreachable_diverging.rs:15:12: 15:13 } bb3: { -- _5 = loop_forever() -> bb5; // scope 3 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = loop_forever() -> bb4; // scope 3 at $DIR/unreachable_diverging.rs:16:13: 16:27 +- _5 = loop_forever() -> bb5; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 ++ _5 = loop_forever() -> bb4; // scope 2 at $DIR/unreachable_diverging.rs:16:13: 16:27 // mir::Constant // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 // + literal: Const { ty: fn() {loop_forever}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff index 0529b15522ea6..f8b41d7b4c5df 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff +++ b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff @@ -13,28 +13,30 @@ let mut _8: !; // 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 + scope 2 { + } } 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 - StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - Deinit(_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: bb1, otherwise: bb3]; // 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 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 + discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:7:28: 7:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 - nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 - goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:8:9: 8:15 + nop; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:9:9: 9:14 } bb3: { diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir index 3c94fbddc4421..5657f9413a1b4 100644 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir +++ b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir @@ -5,6 +5,8 @@ fn change_loop_body() -> () { let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:6:9: 6:15 scope 1 { debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:6:9: 6:15 + scope 2 { + } } bb0: { diff --git a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir index df5a3cb31514d..ec2d161251b00 100644 --- a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -7,52 +7,48 @@ fn while_loop(_1: bool) -> () { let mut _3: bool; // in scope 0 at $DIR/while-storage.rs:10:20: 10:21 let mut _4: bool; // in scope 0 at $DIR/while-storage.rs:11:12: 11:23 let mut _5: bool; // in scope 0 at $DIR/while-storage.rs:11:21: 11:22 - scope 1 { - scope 2 { - } - } bb0: { goto -> bb1; // scope 0 at $DIR/while-storage.rs:10:5: 14:6 } bb1: { - StorageLive(_2); // scope 1 at $DIR/while-storage.rs:10:11: 10:22 - StorageLive(_3); // scope 1 at $DIR/while-storage.rs:10:20: 10:21 - _3 = _1; // scope 1 at $DIR/while-storage.rs:10:20: 10:21 - _2 = get_bool(move _3) -> bb2; // scope 1 at $DIR/while-storage.rs:10:11: 10:22 + StorageLive(_2); // scope 0 at $DIR/while-storage.rs:10:11: 10:22 + StorageLive(_3); // scope 0 at $DIR/while-storage.rs:10:20: 10:21 + _3 = _1; // scope 0 at $DIR/while-storage.rs:10:20: 10:21 + _2 = get_bool(move _3) -> bb2; // scope 0 at $DIR/while-storage.rs:10:11: 10:22 // mir::Constant // + span: $DIR/while-storage.rs:10:11: 10:19 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar()) } } bb2: { - StorageDead(_3); // scope 1 at $DIR/while-storage.rs:10:21: 10:22 - switchInt(move _2) -> [false: bb7, otherwise: bb3]; // scope 1 at $DIR/while-storage.rs:10:11: 10:22 + StorageDead(_3); // scope 0 at $DIR/while-storage.rs:10:21: 10:22 + switchInt(move _2) -> [false: bb7, otherwise: bb3]; // scope 0 at $DIR/while-storage.rs:10:11: 10:22 } bb3: { - StorageLive(_4); // scope 2 at $DIR/while-storage.rs:11:12: 11:23 - StorageLive(_5); // scope 2 at $DIR/while-storage.rs:11:21: 11:22 - _5 = _1; // scope 2 at $DIR/while-storage.rs:11:21: 11:22 - _4 = get_bool(move _5) -> bb4; // scope 2 at $DIR/while-storage.rs:11:12: 11:23 + StorageLive(_4); // scope 0 at $DIR/while-storage.rs:11:12: 11:23 + StorageLive(_5); // scope 0 at $DIR/while-storage.rs:11:21: 11:22 + _5 = _1; // scope 0 at $DIR/while-storage.rs:11:21: 11:22 + _4 = get_bool(move _5) -> bb4; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 // mir::Constant // + span: $DIR/while-storage.rs:11:12: 11:20 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar()) } } bb4: { - StorageDead(_5); // scope 2 at $DIR/while-storage.rs:11:22: 11:23 - switchInt(move _4) -> [false: bb6, otherwise: bb5]; // scope 2 at $DIR/while-storage.rs:11:12: 11:23 + StorageDead(_5); // scope 0 at $DIR/while-storage.rs:11:22: 11:23 + switchInt(move _4) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 } bb5: { - StorageDead(_4); // scope 1 at $DIR/while-storage.rs:13:9: 13:10 - goto -> bb8; // scope 1 at no-location + StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 + goto -> bb8; // scope 0 at no-location } bb6: { - StorageDead(_4); // scope 1 at $DIR/while-storage.rs:13:9: 13:10 + StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 StorageDead(_2); // scope 0 at $DIR/while-storage.rs:14:5: 14:6 goto -> bb1; // scope 0 at $DIR/while-storage.rs:10:5: 14:6 } From a434e4c8f1a97482118f2b0ef833dc3e93bc5103 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Wed, 15 Jun 2022 17:18:44 -0400 Subject: [PATCH 6/6] Add debuginfo test for if let lexical scopes --- src/test/debuginfo/lexical-scope-in-if-let.rs | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/test/debuginfo/lexical-scope-in-if-let.rs diff --git a/src/test/debuginfo/lexical-scope-in-if-let.rs b/src/test/debuginfo/lexical-scope-in-if-let.rs new file mode 100644 index 0000000000000..cdc37ce48fbad --- /dev/null +++ b/src/test/debuginfo/lexical-scope-in-if-let.rs @@ -0,0 +1,100 @@ +// compile-flags:-g + +// === GDB TESTS ================================================================================== + +// gdb-command:run +// gdb-command:info locals +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// gdb-command:continue +// gdb-command:info locals +// gdb-check:z = 10 +// gdb-check:c = 789 +// gdb-check:y = true +// gdb-check:b = 456 +// gdb-check:x = 42 +// gdb-check:a = 123 + +// === LLDB TESTS ================================================================================= + +// lldb-command:run +// lldb-command:frame variable +// lldb-check:(int) a = 123 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true + +// lldb-command:continue +// lldb-command:frame variable +// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10 + +// === CDB TESTS ================================================================================== + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +// cdb-command: g +// cdb-command: dv +// cdb-check:[...]z = 0n10 +// cdb-check:[...]c = 0n789 +// cdb-check:[...]y = true +// cdb-check:[...]b = 0n456 +// cdb-check:[...]a = 0n123 +// cdb-check:[...]x = 0n42 + +fn main() { + let a = id(123); + + zzz(); // #break + + if let Some(x) = id(Some(42)) { + zzz(); // #break + + let b = id(456); + + if let Ok(y) = id::>(Ok(true)) { + zzz(); // #break + + let c = id(789); + + if let (z, 42) = id((10, 42)) { + zzz(); // #break + } + } + } +} + +#[inline(never)] +fn id(value: T) -> T { value } + +fn zzz() { }