From d69725d5d5173e6c6fc20873f306cbd66fa963e7 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 21 May 2023 11:44:37 -0700 Subject: [PATCH] Normalize block and local orders in mir-opt tests Since this only affects `PreCodegen MIR, and it would be nice for that to be resilient to permutations of things that don't affect the actual semantic behaviours. --- src/tools/compiletest/src/runtest.rs | 5 +- .../string.foo.PreCodegen.after.mir | 62 ++-- tests/mir-opt/inline/cycle.g.Inline.diff | 16 +- tests/mir-opt/inline/cycle.main.Inline.diff | 16 +- ...line_closure_captures.foo.Inline.after.mir | 24 +- .../inline/inline_diverging.h.Inline.diff | 38 +-- .../inline/inline_generator.main.Inline.diff | 32 +- .../inline/issue_106141.outer.Inline.diff | 18 +- ..._shl_unsigned_smaller.PreCodegen.after.mir | 132 ++++----- ...ed_shr_signed_smaller.PreCodegen.after.mir | 132 ++++----- ...cked.unwrap_unchecked.PreCodegen.after.mir | 20 +- .../mir-opt/issue_101973.inner.ConstProp.diff | 16 +- ...ue_59352.num_to_digit.PreCodegen.after.mir | 62 ++-- ...witch_targets.ub_if_b.PreCodegen.after.mir | 10 +- ...nge_iter.forward_loop.PreCodegen.after.mir | 76 ++--- ...e_iter.inclusive_loop.PreCodegen.after.mir | 76 ++--- ...mple_option_map.ezmap.PreCodegen.after.mir | 44 +-- ...x.slice_get_mut_usize.PreCodegen.after.mir | 80 ++--- ...t_unchecked_mut_range.PreCodegen.after.mir | 132 ++++----- ...ice_iter.forward_loop.PreCodegen.after.mir | 224 +++++++------- ...ice_iter.reverse_loop.PreCodegen.after.mir | 278 +++++++++--------- .../try_identity.new.PreCodegen.after.mir | 48 +-- .../try_identity.old.PreCodegen.after.mir | 18 +- .../tls_access.main.PreCodegen.after.mir | 16 +- ...le_storage.while_loop.PreCodegen.after.mir | 8 +- 25 files changed, 793 insertions(+), 790 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 5bc4d164265..a799d93ce25 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2045,7 +2045,10 @@ impl<'test> TestCx<'test> { if let Some(pass) = &self.props.mir_unit_test { rustc.args(&["-Zmir-opt-level=0", &format!("-Zmir-enable-passes=+{}", pass)]); } else { - rustc.arg("-Zmir-opt-level=4"); + rustc.args(&[ + "-Zmir-opt-level=4", + "-Zmir-enable-passes=+ReorderBasicBlocks,+ReorderLocals", + ]); } let mir_dump_dir = self.get_mir_dump_dir(); diff --git a/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir b/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir index 97826ed19a2..bcdb12011bc 100644 --- a/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir +++ b/tests/mir-opt/deref-patterns/string.foo.PreCodegen.after.mir @@ -3,41 +3,33 @@ fn foo(_1: Option) -> i32 { debug s => _1; // in scope 0 at $DIR/string.rs:+0:12: +0:13 let mut _0: i32; // return place in scope 0 at $DIR/string.rs:+0:34: +0:37 - let mut _2: &std::string::String; // in scope 0 at $DIR/string.rs:+2:14: +2:17 - let mut _3: &str; // in scope 0 at $DIR/string.rs:+2:14: +2:17 - let mut _4: bool; // in scope 0 at $DIR/string.rs:+2:14: +2:17 - let mut _5: isize; // in scope 0 at $DIR/string.rs:+2:9: +2:18 - let _6: std::option::Option; // in scope 0 at $DIR/string.rs:+3:9: +3:10 - let mut _7: bool; // in scope 0 at $DIR/string.rs:+5:1: +5:2 + let mut _2: bool; // in scope 0 at $DIR/string.rs:+5:1: +5:2 + let mut _3: isize; // in scope 0 at $DIR/string.rs:+2:9: +2:18 + let mut _4: &std::string::String; // in scope 0 at $DIR/string.rs:+2:14: +2:17 + let mut _5: &str; // in scope 0 at $DIR/string.rs:+2:14: +2:17 + let mut _6: bool; // in scope 0 at $DIR/string.rs:+2:14: +2:17 + let _7: std::option::Option; // in scope 0 at $DIR/string.rs:+3:9: +3:10 scope 1 { - debug s => _6; // in scope 1 at $DIR/string.rs:+3:9: +3:10 + debug s => _7; // in scope 1 at $DIR/string.rs:+3:9: +3:10 } bb0: { - _7 = const false; // scope 0 at $DIR/string.rs:+1:11: +1:12 - _7 = const true; // scope 0 at $DIR/string.rs:+1:11: +1:12 - _5 = discriminant(_1); // scope 0 at $DIR/string.rs:+1:11: +1:12 - switchInt(move _5) -> [1: bb2, otherwise: bb1]; // scope 0 at $DIR/string.rs:+1:5: +1:12 + _2 = const false; // scope 0 at $DIR/string.rs:+1:11: +1:12 + _2 = const true; // scope 0 at $DIR/string.rs:+1:11: +1:12 + _3 = discriminant(_1); // scope 0 at $DIR/string.rs:+1:11: +1:12 + switchInt(move _3) -> [1: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+1:5: +1:12 } bb1: { - StorageLive(_6); // scope 0 at $DIR/string.rs:+3:9: +3:10 - _7 = const false; // scope 0 at $DIR/string.rs:+3:9: +3:10 - _6 = move _1; // scope 0 at $DIR/string.rs:+3:9: +3:10 - _0 = const 4321_i32; // scope 1 at $DIR/string.rs:+3:14: +3:18 - drop(_6) -> [return: bb6, unwind unreachable]; // scope 0 at $DIR/string.rs:+3:17: +3:18 - } - - bb2: { - _2 = &((_1 as Some).0: std::string::String); // scope 0 at $DIR/string.rs:+2:14: +2:17 - _3 = ::deref(move _2) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17 + _4 = &((_1 as Some).0: std::string::String); // scope 0 at $DIR/string.rs:+2:14: +2:17 + _5 = ::deref(move _4) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17 // mir::Constant // + span: $DIR/string.rs:9:14: 9:17 // + literal: Const { ty: for<'a> fn(&'a String) -> &'a ::Target {::deref}, val: Value() } } - bb3: { - _4 = ::eq(_3, const "a") -> [return: bb4, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17 + bb2: { + _6 = ::eq(_5, const "a") -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/string.rs:+2:14: +2:17 // mir::Constant // + span: $DIR/string.rs:9:14: 9:17 // + literal: Const { ty: for<'a, 'b> fn(&'a str, &'b str) -> bool {::eq}, val: Value() } @@ -46,29 +38,37 @@ fn foo(_1: Option) -> i32 { // + literal: Const { ty: &str, val: Value(Slice(..)) } } + bb3: { + switchInt(move _6) -> [0: bb5, otherwise: bb4]; // scope 0 at $DIR/string.rs:+2:14: +2:17 + } + bb4: { - switchInt(move _4) -> [0: bb1, otherwise: bb5]; // scope 0 at $DIR/string.rs:+2:14: +2:17 + _0 = const 1234_i32; // scope 0 at $DIR/string.rs:+2:22: +2:26 + goto -> bb7; // scope 0 at $DIR/string.rs:+2:22: +2:26 } bb5: { - _0 = const 1234_i32; // scope 0 at $DIR/string.rs:+2:22: +2:26 - goto -> bb9; // scope 0 at $DIR/string.rs:+2:22: +2:26 + StorageLive(_7); // scope 0 at $DIR/string.rs:+3:9: +3:10 + _2 = const false; // scope 0 at $DIR/string.rs:+3:9: +3:10 + _7 = move _1; // scope 0 at $DIR/string.rs:+3:9: +3:10 + _0 = const 4321_i32; // scope 1 at $DIR/string.rs:+3:14: +3:18 + drop(_7) -> [return: bb6, unwind unreachable]; // scope 0 at $DIR/string.rs:+3:17: +3:18 } bb6: { - StorageDead(_6); // scope 0 at $DIR/string.rs:+3:17: +3:18 - goto -> bb9; // scope 0 at $DIR/string.rs:+3:17: +3:18 + StorageDead(_7); // scope 0 at $DIR/string.rs:+3:17: +3:18 + goto -> bb7; // scope 0 at $DIR/string.rs:+3:17: +3:18 } bb7: { - return; // scope 0 at $DIR/string.rs:+5:2: +5:2 + switchInt(_2) -> [0: bb9, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2 } bb8: { - drop(_1) -> [return: bb7, unwind unreachable]; // scope 0 at $DIR/string.rs:+5:1: +5:2 + drop(_1) -> [return: bb9, unwind unreachable]; // scope 0 at $DIR/string.rs:+5:1: +5:2 } bb9: { - switchInt(_7) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/string.rs:+5:1: +5:2 + return; // scope 0 at $DIR/string.rs:+5:2: +5:2 } } diff --git a/tests/mir-opt/inline/cycle.g.Inline.diff b/tests/mir-opt/inline/cycle.g.Inline.diff index 1e6e30f9e9b..53bf14a0ab6 100644 --- a/tests/mir-opt/inline/cycle.g.Inline.diff +++ b/tests/mir-opt/inline/cycle.g.Inline.diff @@ -8,8 +8,8 @@ + let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8 + scope 1 (inlined f::) { // at $DIR/cycle.rs:12:5: 12:12 + debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7 -+ let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ let mut _4: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ let mut _3: &fn() {main}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ let _4: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + scope 2 (inlined >::call - shim(fn() {main})) { // at $DIR/cycle.rs:6:5: 6:8 + } + } @@ -25,16 +25,16 @@ - // mir::Constant // + span: $DIR/cycle.rs:12:7: 12:11 // + literal: Const { ty: fn() {main}, val: Value() } -+ StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 -+ StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6 -+ _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ _3 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 + _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _4 = move (*_3)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 ++ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 + StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:12 StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:12: +1:13 _0 = const (); // scope 0 at $DIR/cycle.rs:+0:8: +2:2 @@ -51,7 +51,7 @@ + + bb4: { + StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:7: 6:8 + drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 } } diff --git a/tests/mir-opt/inline/cycle.main.Inline.diff b/tests/mir-opt/inline/cycle.main.Inline.diff index 315634945e4..fdf6337a9be 100644 --- a/tests/mir-opt/inline/cycle.main.Inline.diff +++ b/tests/mir-opt/inline/cycle.main.Inline.diff @@ -8,8 +8,8 @@ + let mut _5: (); // in scope 0 at $DIR/cycle.rs:6:5: 6:8 + scope 1 (inlined f::) { // at $DIR/cycle.rs:17:5: 17:9 + debug g => _2; // in scope 1 at $DIR/cycle.rs:5:6: 5:7 -+ let _3: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ let mut _4: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ let mut _3: &fn() {g}; // in scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ let _4: (); // in scope 1 at $DIR/cycle.rs:6:5: 6:8 + scope 2 (inlined >::call - shim(fn() {g})) { // at $DIR/cycle.rs:6:5: 6:8 + } + } @@ -25,16 +25,16 @@ - // mir::Constant // + span: $DIR/cycle.rs:17:7: 17:8 // + literal: Const { ty: fn() {g}, val: Value() } -+ StorageLive(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 -+ StorageLive(_4); // scope 1 at $DIR/cycle.rs:6:5: 6:6 -+ _4 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ StorageLive(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ StorageLive(_3); // scope 1 at $DIR/cycle.rs:6:5: 6:6 ++ _3 = &_2; // scope 1 at $DIR/cycle.rs:6:5: 6:6 + StorageLive(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 + _5 = const (); // scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ _3 = move (*_4)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _4 = move (*_3)() -> [return: bb4, unwind: bb2]; // scope 2 at $SRC_DIR/core/src/ops/function.rs:LL:COL } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 ++ StorageDead(_4); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 + StorageDead(_2); // scope 0 at $DIR/cycle.rs:+1:5: +1:9 StorageDead(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:10 _0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +2:2 @@ -51,7 +51,7 @@ + + bb4: { + StorageDead(_5); // scope 1 at $DIR/cycle.rs:6:5: 6:8 -+ StorageDead(_4); // scope 1 at $DIR/cycle.rs:6:7: 6:8 ++ StorageDead(_3); // scope 1 at $DIR/cycle.rs:6:7: 6:8 + drop(_2) -> bb1; // scope 1 at $DIR/cycle.rs:7:1: 7:2 } } diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index b36711f82f4..33bf3b73b23 100644 --- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -17,10 +17,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) { debug _q => _9; // in scope 2 at $DIR/inline_closure_captures.rs:+1:14: +1:16 debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline_closure_captures.rs:+0:23: +0:24 debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline_closure_captures.rs:+0:17: +0:18 - let mut _10: i32; // in scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 - let mut _11: T; // in scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 - let mut _12: &i32; // in scope 2 at $DIR/inline_closure_captures.rs:+1:13: +1:24 - let mut _13: &T; // in scope 2 at $DIR/inline_closure_captures.rs:+1:13: +1:24 + let mut _10: &i32; // in scope 2 at $DIR/inline_closure_captures.rs:+1:13: +1:24 + let mut _11: i32; // in scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 + let mut _12: &T; // in scope 2 at $DIR/inline_closure_captures.rs:+1:13: +1:24 + let mut _13: T; // in scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 } } @@ -49,15 +49,15 @@ fn foo(_1: T, _2: i32) -> (i32, T) { _7 = (move _8,); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9 StorageLive(_9); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9 _9 = move (_7.0: i32); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9 - StorageLive(_10); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 - _12 = deref_copy ((*_6).0: &i32); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 - _10 = (*_12); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 - StorageLive(_11); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 - _13 = deref_copy ((*_6).1: &T); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 - _11 = (*_13); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 - _0 = (move _10, move _11); // scope 2 at $DIR/inline_closure_captures.rs:+1:18: +1:24 + StorageLive(_11); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 + _10 = deref_copy ((*_6).0: &i32); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 + _11 = (*_10); // scope 2 at $DIR/inline_closure_captures.rs:+1:19: +1:20 + StorageLive(_13); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 + _12 = deref_copy ((*_6).1: &T); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 + _13 = (*_12); // scope 2 at $DIR/inline_closure_captures.rs:+1:22: +1:23 + _0 = (move _11, move _13); // scope 2 at $DIR/inline_closure_captures.rs:+1:18: +1:24 + StorageDead(_13); // scope 2 at $DIR/inline_closure_captures.rs:+1:23: +1:24 StorageDead(_11); // scope 2 at $DIR/inline_closure_captures.rs:+1:23: +1:24 - StorageDead(_10); // scope 2 at $DIR/inline_closure_captures.rs:+1:23: +1:24 StorageDead(_9); // scope 1 at $DIR/inline_closure_captures.rs:+2:5: +2:9 StorageDead(_8); // scope 1 at $DIR/inline_closure_captures.rs:+2:8: +2:9 StorageDead(_7); // scope 1 at $DIR/inline_closure_captures.rs:+2:8: +2:9 diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.diff index d501b6ca8d2..255451e8670 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.diff @@ -8,15 +8,15 @@ + let mut _8: (); // in scope 0 at $DIR/inline_diverging.rs:27:13: 27:16 + scope 1 (inlined call_twice:: ! {sleep}>) { // at $DIR/inline_diverging.rs:22:5: 22:22 + debug f => _2; // in scope 1 at $DIR/inline_diverging.rs:26:36: 26:37 -+ let _3: !; // in scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 -+ let mut _4: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ let mut _3: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ let _4: !; // in scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 + let mut _5: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline_diverging.rs:28:13: 28:14 -+ let mut _6: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7 -+ let mut _7: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10 ++ let mut _6: !; // in scope 1 at $DIR/inline_diverging.rs:29:9: 29:10 ++ let mut _7: !; // in scope 1 at $DIR/inline_diverging.rs:29:6: 29:7 + scope 2 { -+ debug a => _3; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10 ++ debug a => _4; // in scope 2 at $DIR/inline_diverging.rs:27:9: 27:10 + scope 3 { -+ debug b => _7; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 ++ debug b => _6; // in scope 3 at $DIR/inline_diverging.rs:28:9: 28:10 + } + } + scope 4 (inlined ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline_diverging.rs:27:13: 27:16 @@ -34,22 +34,22 @@ - // mir::Constant // + span: $DIR/inline_diverging.rs:22:16: 22:21 // + literal: Const { ty: fn() -> ! {sleep}, val: Value() } -+ StorageLive(_7); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 -+ StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 -+ StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 -+ _4 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ StorageLive(_6); // scope 0 at $DIR/inline_diverging.rs:+1:5: +1:22 ++ StorageLive(_4); // scope 1 at $DIR/inline_diverging.rs:27:9: 27:10 ++ StorageLive(_3); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 ++ _3 = &_2; // scope 1 at $DIR/inline_diverging.rs:27:13: 27:14 + StorageLive(_8); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 + _8 = const (); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 -+ _3 = move (*_4)() -> [return: bb6, unwind: bb4]; // scope 4 at $SRC_DIR/core/src/ops/function.rs:LL:COL ++ _4 = move (*_3)() -> [return: bb6, unwind: bb4]; // scope 4 at $SRC_DIR/core/src/ops/function.rs:LL:COL + } + + bb1: { + StorageDead(_5); // scope 2 at $DIR/inline_diverging.rs:28:15: 28:16 -+ StorageLive(_6); // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 -+ _6 = move _3; // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 -+ _1 = (move _6, move _7); // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 -+ StorageDead(_6); // scope 3 at $DIR/inline_diverging.rs:29:10: 29:11 -+ StorageDead(_3); // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ StorageLive(_7); // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 ++ _7 = move _4; // scope 3 at $DIR/inline_diverging.rs:29:6: 29:7 ++ _1 = (move _7, move _6); // scope 3 at $DIR/inline_diverging.rs:29:5: 29:11 ++ StorageDead(_7); // scope 3 at $DIR/inline_diverging.rs:29:10: 29:11 ++ StorageDead(_4); // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + drop(_2) -> bb2; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + } + @@ -58,7 +58,7 @@ + } + + bb3 (cleanup): { -+ drop(_3) -> [return: bb4, unwind terminate]; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 ++ drop(_4) -> [return: bb4, unwind terminate]; // scope 1 at $DIR/inline_diverging.rs:30:1: 30:2 + } + + bb4 (cleanup): { @@ -71,10 +71,10 @@ + + bb6: { + StorageDead(_8); // scope 1 at $DIR/inline_diverging.rs:27:13: 27:16 -+ StorageDead(_4); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16 ++ StorageDead(_3); // scope 1 at $DIR/inline_diverging.rs:27:15: 27:16 + StorageLive(_5); // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 + _5 = &_2; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:14 -+ _7 = ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb1, unwind: bb3]; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 ++ _6 = ! {sleep} as Fn<()>>::call(move _5, const ()) -> [return: bb1, unwind: bb3]; // scope 2 at $DIR/inline_diverging.rs:28:13: 28:16 + // mir::Constant + // + span: $DIR/inline_diverging.rs:28:13: 28:14 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a fn() -> ! {sleep}, ()) -> ! {sleep} as FnOnce<()>>::Output { ! {sleep} as Fn<()>>::call}, val: Value() } diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.diff b/tests/mir-opt/inline/inline_generator.main.Inline.diff index c3ca2d7d42c..0dcae1e4d45 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.diff @@ -23,9 +23,9 @@ + } + scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:33: 9:46 + debug a => _5; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7 -+ let mut _6: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39 ++ let mut _6: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + let mut _7: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 -+ let mut _8: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ let mut _8: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39 + let mut _9: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + let mut _10: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41 + } @@ -70,9 +70,9 @@ - // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator>::resume}, val: Value() } + StorageLive(_5); // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46 + _5 = const false; // scope 0 at $DIR/inline_generator.rs:+1:33: +1:46 -+ _8 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 -+ _7 = discriminant((*_8)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 -+ switchInt(move _7) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ _6 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ _7 = discriminant((*_6)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 } - bb3: { @@ -91,40 +91,40 @@ + } + + bb3: { -+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 -+ switchInt(_5) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21 ++ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 ++ switchInt(_5) -> [0: bb4, otherwise: bb5]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21 + } + + bb4: { -+ _6 = const 7_i32; // scope 6 at $DIR/inline_generator.rs:15:24: 15:25 ++ _8 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37 + goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39 + } + + bb5: { -+ _6 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37 ++ _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 + } + + bb6: { -+ _1 = GeneratorState::::Yielded(move _6); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 ++ _1 = GeneratorState::::Yielded(move _8); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + discriminant((*_9)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39 + goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39 + } + + bb7: { -+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 -+ StorageDead(_6); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39 ++ assert(const false, "generator resumed after completion") -> [success: bb7, unwind: bb2]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ } ++ ++ bb8: { ++ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 ++ StorageDead(_8); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39 + _1 = GeneratorState::::Complete(_5); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + discriminant((*_10)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41 + goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41 + } + -+ bb8: { -+ assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 -+ } -+ + bb9: { + unreachable; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41 } diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.diff index 3aebfb69e0a..5fed54f83a7 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.diff @@ -4,9 +4,9 @@ fn outer() -> usize { let mut _0: usize; // return place in scope 0 at $DIR/issue_106141.rs:+0:19: +0:24 + scope 1 (inlined inner) { // at $DIR/issue_106141.rs:3:5: 3:12 -+ let mut _1: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 ++ let mut _1: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:12:18: 12:25 + let mut _2: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 -+ let mut _3: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:12:18: 12:25 ++ let mut _3: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 + scope 2 { + debug buffer => const _; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15 + scope 3 { @@ -17,8 +17,8 @@ bb0: { - _0 = inner() -> bb1; // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 -+ StorageLive(_3); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 -+ _3 = const _; // scope 1 at $DIR/issue_106141.rs:12:18: 12:25 ++ StorageLive(_1); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 ++ _1 = const _; // scope 1 at $DIR/issue_106141.rs:12:18: 12:25 // mir::Constant - // + span: $DIR/issue_106141.rs:3:5: 3:10 - // + literal: Const { ty: fn() -> usize {inner}, val: Value() } @@ -31,14 +31,14 @@ } bb1: { -+ StorageLive(_1); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ StorageLive(_3); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 + _2 = Lt(_0, const 1_usize); // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 + assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> bb2; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 + } + + bb2: { -+ _1 = (*_3)[_0]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 -+ switchInt(move _1) -> [0: bb3, otherwise: bb4]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ _3 = (*_1)[_0]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 ++ switchInt(move _3) -> [0: bb3, otherwise: bb4]; // scope 3 at $DIR/issue_106141.rs:14:8: 14:21 + } + + bb3: { @@ -47,8 +47,8 @@ + } + + bb4: { -+ StorageDead(_1); // scope 3 at $DIR/issue_106141.rs:18:5: 18:6 -+ StorageDead(_3); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 ++ StorageDead(_3); // scope 3 at $DIR/issue_106141.rs:18:5: 18:6 ++ StorageDead(_1); // scope 0 at $DIR/issue_106141.rs:+1:5: +1:12 return; // scope 0 at $DIR/issue_106141.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir index 3c175ed1504..f4b2416eaab 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir @@ -7,38 +7,38 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _3: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _4: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _13: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _4; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _8: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _11: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 4 { scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug self => _4; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _10: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + debug u => _4; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _5: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _6: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _7: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } } scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let _12: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + debug self => _8; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let mut _9: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let _10: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL scope 8 { - debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + debug x => _10; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL } } scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _11; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _12: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _14: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL scope 10 { - debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL + debug val => _13; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL } scope 11 { scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL @@ -49,7 +49,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { } } scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _14; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL } } } @@ -58,81 +58,81 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { } bb0: { + StorageLive(_13); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _3 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _9 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _4 = move (_3.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_11); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _5 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _6 = Gt(_4, move _5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + switchInt(move _6) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb1: { - StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _7 = _4 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _8 = Result::::Ok(move _7); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb2: { - _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _8 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL // mir::Constant // + span: no-location // + literal: Const { ty: TryFromIntError, val: Value() } - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb3: { - StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _10 = _5 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _9 = discriminant(_8); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _9) -> [0: bb4, 1: bb5, otherwise: bb9]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb4: { - StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _10 = move ((_8 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _11 = Option::::Some(move _10); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb5: { - _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _11 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb6: { - unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_10); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _12 = discriminant(_11); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _12) -> [1: bb7, otherwise: bb9]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL } bb7: { - _12 = move ((_7 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb8: { - StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - } - - bb9: { - _3 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _13 = move ((_11 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _0 = unchecked_shl::(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _0 = unchecked_shl::(_1, move _13) -> [return: bb8, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } } + + bb8: { + StorageDead(_13); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } + + bb9: { + unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir index 724b3c56723..67f0fe8932f 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir @@ -7,38 +7,38 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { scope 1 (inlined core::num::::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _3: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _4: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _13: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _4; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _8: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _11: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 4 { scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug self => _4; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _10: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + debug u => _4; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _5: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _6: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _7: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } } scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let _12: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + debug self => _8; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let mut _9: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let _10: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL scope 8 { - debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + debug x => _10; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL } } scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _11; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _12: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _14: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL scope 10 { - debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL + debug val => _13; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL } scope 11 { scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL @@ -49,7 +49,7 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { } } scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _14; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL } } } @@ -58,81 +58,81 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { } bb0: { + StorageLive(_13); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _3 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _9 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _4 = move (_3.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_11); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _5 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _6 = Gt(_4, move _5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + switchInt(move _6) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb1: { - StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _7 = _4 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _8 = Result::::Ok(move _7); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb2: { - _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _8 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL // mir::Constant // + span: no-location // + literal: Const { ty: TryFromIntError, val: Value() } - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb3: { - StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _10 = _5 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _9 = discriminant(_8); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _9) -> [0: bb4, 1: bb5, otherwise: bb9]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb4: { - StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _10 = move ((_8 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _11 = Option::::Some(move _10); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb5: { - _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _11 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb6; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb6: { - unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_10); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _12 = discriminant(_11); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _12) -> [1: bb7, otherwise: bb9]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL } bb7: { - _12 = move ((_7 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb8: { - StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - } - - bb9: { - _3 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _13 = move ((_11 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _0 = unchecked_shr::(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _0 = unchecked_shr::(_1, move _13) -> [return: bb8, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } } + + bb8: { + StorageDead(_13); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } + + bb9: { + unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir index c5e2469fc27..601d83702f4 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir @@ -5,8 +5,8 @@ fn unwrap_unchecked(_1: Option) -> T { let mut _0: T; // return place in scope 0 at $DIR/unwrap_unchecked.rs:+0:54: +0:55 scope 1 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $DIR/unwrap_unchecked.rs:10:9: 10:27 debug self => _1; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _2: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _2: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL scope 2 { debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL } @@ -19,23 +19,23 @@ fn unwrap_unchecked(_1: Option) -> T { } } scope 4 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _2; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _3; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL } } bb0: { - StorageLive(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 - _3 = discriminant(_1); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _3) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + _2 = discriminant(_1); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _2) -> [1: bb1, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL } bb1: { - unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + _0 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 } bb2: { - _0 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 - return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 + unreachable; // scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL } } diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.diff b/tests/mir-opt/issue_101973.inner.ConstProp.diff index d048b9e6513..2f68f65c874 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.diff @@ -18,8 +18,8 @@ let mut _13: bool; // in scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 scope 1 (inlined imm8) { // at $DIR/issue_101973.rs:15:5: 15:17 debug x => _1; // in scope 1 at $DIR/issue_101973.rs:6:13: 6:14 - let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:27 - let mut _15: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:20 + let mut _14: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:20 + let mut _15: u32; // in scope 1 at $DIR/issue_101973.rs:8:12: 8:27 scope 2 { debug out => _4; // in scope 2 at $DIR/issue_101973.rs:7:9: 7:16 } @@ -33,13 +33,13 @@ StorageLive(_2); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65 StorageLive(_3); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:58 StorageLive(_4); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:17 - StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 - StorageLive(_15); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 - _15 = Shr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 - _14 = BitAnd(move _15, const 255_u32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 - StorageDead(_15); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 - _4 = BitOr(const 0_u32, move _14); // scope 2 at $DIR/issue_101973.rs:8:5: 8:27 + StorageLive(_15); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 + StorageLive(_14); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 + _14 = Shr(_1, const 0_i32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:20 + _15 = BitAnd(move _14, const 255_u32); // scope 2 at $DIR/issue_101973.rs:8:12: 8:27 StorageDead(_14); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 + _4 = BitOr(const 0_u32, move _15); // scope 2 at $DIR/issue_101973.rs:8:5: 8:27 + StorageDead(_15); // scope 2 at $DIR/issue_101973.rs:8:26: 8:27 StorageLive(_6); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57 StorageLive(_7); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:52 StorageLive(_8); // scope 0 at $DIR/issue_101973.rs:+1:32: +1:45 diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 9f955b4717b..fac4b8a2d25 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -3,19 +3,19 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24 let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 + let mut _5: std::option::Option; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue_59352.rs:15:12: 15:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL debug radix => const 8_u32; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let _2: std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let _4: std::option::Option; // 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 => _3; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _5: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _4: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL } } scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue_59352.rs:15:42: 15:50 - debug self => _2; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _5; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL let mut _6: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL let mut _7: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL scope 4 { @@ -25,44 +25,35 @@ fn num_to_digit(_1: char) -> u32 { bb0: { StorageLive(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _4 = char::methods::::to_digit(_1, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageLive(_2); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _2 = char::methods::::to_digit(_1, const 8_u32) -> bb1; // 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() } } bb1: { - StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 - _2 = char::methods::::to_digit(_1, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 + _3 = &_2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _4 = discriminant((*_3)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + StorageDead(_2); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + switchInt(move _4) -> [1: bb2, otherwise: bb7]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 + } + + bb2: { + StorageLive(_5); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 + _5 = char::methods::::to_digit(_1, const 8_u32) -> bb3; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 // mir::Constant // + span: $DIR/issue_59352.rs:15:30: 15:38 // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value() } } - bb2: { - _6 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _6) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - } - bb3: { - _0 = const 0_u32; // scope 0 at $DIR/issue_59352.rs:+2:60: +2:61 - goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 + _6 = discriminant(_5); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } bb4: { - return; // scope 0 at $DIR/issue_59352.rs:+3:2: +3:2 - } - - bb5: { - _3 = &_4; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _5 = discriminant((*_3)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 - } - - bb6: { _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/option.rs:LL:COL @@ -72,13 +63,22 @@ fn num_to_digit(_1: char) -> u32 { // + literal: Const { ty: &str, val: Value(Slice(..)) } } - bb7: { + bb5: { + _0 = move ((_5 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_5); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50 + goto -> bb8; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 + } + + bb6: { unreachable; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } + bb7: { + _0 = const 0_u32; // scope 0 at $DIR/issue_59352.rs:+2:60: +2:61 + goto -> bb8; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 + } + bb8: { - _0 = move ((_2 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50 - goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63 + return; // scope 0 at $DIR/issue_59352.rs:+3:2: +3:2 } } diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir index 0e885cf94fd..6b805166ba2 100644 --- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir @@ -13,15 +13,15 @@ fn ub_if_b(_1: Thing) -> Thing { bb0: { _2 = discriminant(_1); // scope 0 at $DIR/duplicate_switch_targets.rs:+1:11: +1:12 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/duplicate_switch_targets.rs:+1:5: +1:12 + switchInt(move _2) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/duplicate_switch_targets.rs:+1:5: +1:12 } bb1: { - unreachable; // scope 2 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - - bb2: { _0 = move _1; // scope 0 at $DIR/duplicate_switch_targets.rs:+2:21: +2:22 return; // scope 0 at $DIR/duplicate_switch_targets.rs:+5:2: +5:2 } + + bb2: { + unreachable; // scope 2 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir index 343a4a5a6f3..9856cdd5688 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir @@ -7,20 +7,20 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:60: +0:60 let mut _4: std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 let mut _5: std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 - let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 let mut _7: std::option::Option; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 - let mut _8: &mut std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 - let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 - let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 - let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + let mut _8: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 + let mut _10: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 + let mut _11: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + let _12: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 scope 1 { debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:24 - let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + let _9: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 scope 2 { - debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 + debug x => _9; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 } scope 4 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:21:14: 21:24 - debug self => _8; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _6; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL } } scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:21:14: 21:24 @@ -36,56 +36,56 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 - _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 - _7 = as iter::range::RangeIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _6 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb8]; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } } bb2: { - _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 - StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 - _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 - StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 - _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 - _6 = >::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _8 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + } + + bb3: { + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 + drop(_3) -> bb4; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb4: { + return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 + } + + bb5: { + _9 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + StorageLive(_10); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + _10 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _11 = (_9,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _12 = >::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 // mir::Constant // + span: $DIR/range_iter.rs:22:9: 22:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } } - bb3: { - unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 - } - - bb4: { - StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 - StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 - drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 - } - - bb5: { - StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + bb6: { StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_10); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 } - bb6: { - return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 - } - - bb7 (cleanup): { - drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + bb7: { + unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 } bb8 (cleanup): { - resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2 + drop(_3) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 } - bb9: { - _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 - switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + bb9 (cleanup): { + resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2 } } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir index f45eabba252..a187d650a77 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir @@ -7,20 +7,20 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:62: +0:62 let mut _4: std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 let mut _5: std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 - let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _6: &mut std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 let mut _7: std::option::Option; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 - let mut _8: &mut std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 - let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 - let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 - let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + let mut _8: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 + let mut _10: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 + let mut _11: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + let _12: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 scope 1 { debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:25 - let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + let _9: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 scope 2 { - debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 + debug x => _9; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 } scope 5 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:28:14: 28:25 - debug self => _8; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL } } scope 3 (inlined RangeInclusive::::new) { // at $DIR/range_iter.rs:28:14: 28:25 @@ -40,56 +40,56 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 - _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 - _7 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _6 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + _7 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb8]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive) -> Option< as iter::range::RangeInclusiveIteratorImpl>::Item> { as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value() } } bb2: { - _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 - StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 - _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 - StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 - _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 - _6 = >::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _8 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + } + + bb3: { + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 + drop(_3) -> bb4; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb4: { + return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 + } + + bb5: { + _9 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + StorageLive(_10); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + _10 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _11 = (_9,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _12 = >::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 // mir::Constant // + span: $DIR/range_iter.rs:29:9: 29:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } } - bb3: { - unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 - } - - bb4: { - StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 - StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 - drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 - } - - bb5: { - StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + bb6: { StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_10); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 } - bb6: { - return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 - } - - bb7 (cleanup): { - drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + bb7: { + unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 } bb8 (cleanup): { - resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2 + drop(_3) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 } - bb9: { - _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 - switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + bb9 (cleanup): { + resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2 } } diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir index 986ab35886f..089b0c23e2c 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -3,18 +3,18 @@ fn ezmap(_1: Option) -> Option { debug x => _1; // in scope 0 at $DIR/simple_option_map.rs:+0:14: +0:15 let mut _0: std::option::Option; // return place in scope 0 at $DIR/simple_option_map.rs:+0:33: +0:44 - let mut _6: i32; // in scope 0 at $DIR/simple_option_map.rs:11:25: 11:29 + let mut _5: i32; // in scope 0 at $DIR/simple_option_map.rs:11:25: 11:29 scope 1 (inlined map::) { // at $DIR/simple_option_map.rs:18:5: 18:22 debug slf => _1; // in scope 1 at $DIR/simple_option_map.rs:6:17: 6:20 debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15]; // in scope 1 at $DIR/simple_option_map.rs:6:33: 6:34 let mut _2: isize; // in scope 1 at $DIR/simple_option_map.rs:11:9: 11:16 let _3: i32; // in scope 1 at $DIR/simple_option_map.rs:11:14: 11:15 - let mut _4: i32; // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29 - let mut _5: (i32,); // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29 + let mut _4: (i32,); // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29 + let mut _6: i32; // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29 scope 2 { debug x => _3; // in scope 2 at $DIR/simple_option_map.rs:11:14: 11:15 scope 3 (inlined ezmap::{closure#0}) { // at $DIR/simple_option_map.rs:11:25: 11:29 - debug n => _6; // in scope 3 at $DIR/simple_option_map.rs:+1:13: +1:14 + debug n => _5; // in scope 3 at $DIR/simple_option_map.rs:+1:13: +1:14 } } } @@ -22,35 +22,35 @@ fn ezmap(_1: Option) -> Option { bb0: { StorageLive(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22 _2 = discriminant(_1); // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14 - switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map.rs:10:5: 10:14 + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 1 at $DIR/simple_option_map.rs:10:5: 10:14 } bb1: { _0 = Option::::None; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21 - goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21 + goto -> bb3; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21 } bb2: { - unreachable; // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14 + _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map.rs:11:14: 11:15 + StorageLive(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + StorageLive(_4); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + _4 = (move _3,); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + StorageLive(_5); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + _5 = move (_4.0: i32); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + _6 = Add(_5, const 1_i32); // scope 3 at $DIR/simple_option_map.rs:+1:16: +1:21 + StorageDead(_5); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + StorageDead(_4); // scope 2 at $DIR/simple_option_map.rs:11:28: 11:29 + _0 = Option::::Some(move _6); // scope 2 at $DIR/simple_option_map.rs:11:20: 11:30 + StorageDead(_6); // scope 2 at $DIR/simple_option_map.rs:11:29: 11:30 + goto -> bb3; // scope 1 at $DIR/simple_option_map.rs:14:1: 14:2 } bb3: { - _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map.rs:11:14: 11:15 - StorageLive(_4); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 - StorageLive(_5); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 - _5 = (move _3,); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 - StorageLive(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 - _6 = move (_5.0: i32); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 - _4 = Add(_6, const 1_i32); // scope 3 at $DIR/simple_option_map.rs:+1:16: +1:21 - StorageDead(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 - StorageDead(_5); // scope 2 at $DIR/simple_option_map.rs:11:28: 11:29 - _0 = Option::::Some(move _4); // scope 2 at $DIR/simple_option_map.rs:11:20: 11:30 - StorageDead(_4); // scope 2 at $DIR/simple_option_map.rs:11:29: 11:30 - goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:14:1: 14:2 - } - - bb4: { StorageDead(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22 return; // scope 0 at $DIR/simple_option_map.rs:+2:2: +2:2 } + + bb4: { + unreachable; // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14 + } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir index 715a1e3fcd4..b05d44f4d60 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir @@ -10,17 +10,17 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { scope 2 (inlined >::get_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug self => _2; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL debug slice => _1; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _3: bool; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _3: &[u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _4: usize; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _5: &[u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _6: &mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _7: *mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _8: *mut [u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _5: bool; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _6: *mut [u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _8: *mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _9: &mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 3 { scope 4 (inlined >::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL debug self => _2; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug slice => _8; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _9: *mut u32; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _6; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _7: *mut u32; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _10: usize; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL let mut _11: *mut [u32]; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 5 { @@ -40,10 +40,10 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } } scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _8; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _6; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _9; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _7; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL debug count => _2; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 13 { } @@ -56,40 +56,19 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_9); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _5 = &(*_1); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _4 = Len((*_5)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _3 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _3 = &(*_1); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _4 = Len((*_3)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _5 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL } bb1: { - StorageLive(_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _8 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _9 = _8 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - _7 = Offset(_9, _2); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _6 = &mut (*_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _0 = Option::<&mut u32>::Some(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_7); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - } - - bb2: { _0 = const Option::<&mut u32>::None; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL // mir::Constant // + span: no-location @@ -97,9 +76,30 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL } + bb2: { + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _6 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _7 = _6 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + _8 = Offset(_7, _2); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = &mut (*_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _0 = Option::<&mut u32>::Some(_9); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_8); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + bb3: { - StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_9); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir index 7a10b929ebd..6d9ec5d9a27 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir @@ -8,61 +8,61 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL let mut _3: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _4: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _15: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 2 { scope 3 (inlined as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug self => _2; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug slice => _4; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let _5: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _7: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _3; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _4: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _5: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _7: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _8: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _9: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _10: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _11: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _12: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _13: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _14: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _10: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _16: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _17: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _18: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 4 { - debug this => _5; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug this => _16; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 5 { let _6: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 6 { debug new_len => _6; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _3; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _10; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug count => _11; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _7; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _8; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 13 { } } scope 14 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL debug data => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _12; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _16: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _10; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _11: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL scope 15 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL debug self => _9; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _16; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _12; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _17: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _18: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _19: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug data_address => _11; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _10; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _12: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _13: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _14: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL scope 17 { } } } } scope 7 (inlined as SliceIndex<[T]>>::get_unchecked_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug this => _13; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug slice => _14; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug this => _17; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug slice => _18; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 8 (inlined ptr::mut_ptr::::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _14; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _18; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _19: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug ptr => _19; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL scope 10 { } } @@ -75,60 +75,60 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } bb0: { - StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _4 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_16); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_17); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_18); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_19); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _7 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _8 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _6 = unchecked_sub::(move _7, move _8) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_4); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _4 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_5); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _5 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _6 = unchecked_sub::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::}, val: Value() } } bb1: { - StorageDead(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_5); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_4); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _7 = _3 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _8 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = Offset(_7, _8); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageLive(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _10 = _4 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _11 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _9 = Offset(_10, _11); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _10 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_11); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _11 = _9 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_14); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_13); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_12); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _12 = _11 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _13 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _12, metadata: _10 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_12); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _14 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _13 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_13); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _15 = (_14.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_14); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_11); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL StorageDead(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _12 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _16 = _9 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_17); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _19 = _16 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _18 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _19, metadata: _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _17 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _18 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _3 = (_17.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_17); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageDead(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _0 = &mut (*_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_19); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_18); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_17); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_16); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _0 = &mut (*_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_15); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir index 0da7e5536ae..0cf1d68d18a 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir @@ -4,41 +4,41 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33 debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45 let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60 - let mut _3: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - let _5: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - let mut _6: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - let mut _7: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 - let mut _10: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 - let mut _11: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _14: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _15: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _16: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _17: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _19: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _20: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + let _21: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 scope 1 { - debug iter => _4; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 - let _9: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + debug iter => _14; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + let _18: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 scope 2 { - debug x => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + debug x => _18; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 } } scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:28:20: 28:26 debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _14: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _15: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _17: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _18: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _19: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 5 { - debug ptr => _12; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 6 { - let _13: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 7 { - debug end => _13; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _18; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _21: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL let mut _22: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL @@ -65,13 +65,13 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL scope 10 { } } scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _12; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - debug count => _16; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL scope 12 { } } @@ -79,125 +79,125 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _20: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL } } } scope 22 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26 - debug self => _3; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } bb0: { - StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _20 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _12 = move _20 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _14 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _14) -> [0: bb11, otherwise: bb10]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL } bb1: { - StorageLive(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 - _7 = &mut _4; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 - _6 = as Iterator>::next(_7) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_14); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + _14 = move _13; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_16); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + _15 = &mut _14; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + _16 = as Iterator>::next(_15) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 // mir::Constant // + span: $DIR/slice_iter.rs:28:14: 28:26 // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } - bb2: { - _8 = discriminant(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 - switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 - } - - bb3: { - _9 = ((_6 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 - StorageLive(_10); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 - _10 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 - StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 - _11 = (_9,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 - _5 = >::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 - // mir::Constant - // + span: $DIR/slice_iter.rs:29:9: 29:10 - // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } - } - - bb4: { - unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 - } - bb5: { - StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 - StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 - drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + _17 = discriminant(_16); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 } bb6: { - StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 - StorageDead(_10); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 - StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 - goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + StorageDead(_16); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_14); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 } bb7: { return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 } - bb8 (cleanup): { - drop(_2) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + bb8: { + _18 = ((_16 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + StorageLive(_19); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _19 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_20); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _20 = (_18,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _21 = >::call(move _19, move _20) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/slice_iter.rs:29:9: 29:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } } - bb9 (cleanup): { - resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 + bb9: { + StorageDead(_20); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_19); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_16); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 } bb10: { - StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _15 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _13 = _15 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 } - bb11: { - StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _13 = Offset(_12, _16); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + bb11 (cleanup): { + drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 } - bb12: { - StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _18 = _12 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _21 = _18 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _17 = NonNull:: { pointer: _21 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _19 = _13; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _3 = std::slice::Iter::<'_, T> { ptr: move _17, end: move _19, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&T>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - _4 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + bb12 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir index 45b41b54c8b..4fde50c6fe4 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir @@ -4,61 +4,61 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33 debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45 let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60 - let mut _3: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - let mut _5: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - let _6: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - let mut _7: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - let mut _8: &mut std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - let mut _9: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 - let mut _11: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 - let mut _12: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _14: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _15: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _16: &mut std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _18: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _19: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _21: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _22: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + let _23: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 scope 1 { - debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 - let _10: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + debug iter => _15; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + let _20: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 scope 2 { - debug x => _10; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 } scope 25 (inlined > as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32 - debug self => _8; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - let mut _25: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + debug self => _16; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + let mut _17: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL } } scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:35:20: 35:26 debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _13: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _15: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _17: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _18: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _19: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _20: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 5 { - debug ptr => _13; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 6 { - let _14: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 7 { - debug end => _14; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _19; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _22: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _23: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _24: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _23; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _24; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _23; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _25: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 17 { scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _25; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _25; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 20 { scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _25; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } } } @@ -70,13 +70,13 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _16; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL scope 10 { } } scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _13; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - debug count => _17; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL scope 12 { } } @@ -84,137 +84,137 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _21: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL } } } scope 22 (inlined as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32 - debug self => _4; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL scope 23 (inlined Rev::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - debug iter => _4; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL } } scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32 - debug self => _3; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } bb0: { - StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 - StorageLive(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _21 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _13 = move _21 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _15 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _15) -> [0: bb10, otherwise: bb9]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_13); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL } bb1: { - StorageLive(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 - _8 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 - StorageLive(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - _25 = &mut ((*_8).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - _7 = as DoubleEndedIterator>::next_back(move _25) -> [return: bb12, unwind: bb7]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL } bb2: { - _10 = ((_7 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 - StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 - _11 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 - StorageLive(_12); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 - _12 = (_10,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 - _6 = >::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 - // mir::Constant - // + span: $DIR/slice_iter.rs:36:9: 36:10 - // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL } bb3: { - unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 - } - - bb4: { - StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 - StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 - drop(_2) -> bb6; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 - } - - bb5: { - StorageDead(_12); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 - StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 - StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 - goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 - } - - bb6: { - return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 - } - - bb7 (cleanup): { - drop(_2) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 - } - - bb8 (cleanup): { - resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 - } - - bb9: { - StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _14 = _16 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb10: { - StorageLive(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _17 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _14 = Offset(_13, _17); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageDead(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb11: { - StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _19 = _13 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _22 = _19 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _18 = NonNull:: { pointer: _22 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = _14; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _4 = std::slice::Iter::<'_, T> { ptr: move _18, end: move _20, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL // mir::Constant // + span: no-location // + literal: Const { ty: PhantomData<&T>, val: Value() } // adt // + user_ty: UserType(1) - StorageDead(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _3 = Rev::> { iter: move _4 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32 - StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - _5 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 - goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _14 = Rev::> { iter: move _13 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + StorageDead(_13); // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32 + StorageLive(_15); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + _15 = move _14; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 } - bb12: { - StorageDead(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL - _9 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 - switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + bb4: { + StorageLive(_18); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + _16 = &mut _15; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + StorageLive(_17); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _17 = &mut ((*_16).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _18 = as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } + } + + bb5: { + StorageDead(_17); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _19 = discriminant(_18); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + } + + bb6: { + StorageDead(_18); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_15); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8: { + _20 = ((_18 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + StorageLive(_21); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _21 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_22); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _22 = (_20,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/slice_iter.rs:36:9: 36:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_22); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_21); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_18); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + } + + bb11 (cleanup): { + drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb12 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 } } diff --git a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir index 53971b4cffc..c3f8745b422 100644 --- a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir @@ -3,15 +3,15 @@ fn new(_1: Result) -> Result { debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15 let mut _0: std::result::Result; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46 - let mut _2: std::ops::ControlFlow; // in scope 0 at $DIR/try_identity.rs:+2:15: +7:10 - let mut _3: isize; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:22 - let _4: T; // in scope 0 at $DIR/try_identity.rs:+4:20: +4:21 + let mut _2: isize; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:22 + let _3: T; // in scope 0 at $DIR/try_identity.rs:+4:20: +4:21 + let mut _4: std::ops::ControlFlow; // in scope 0 at $DIR/try_identity.rs:+2:15: +7:10 let _5: E; // in scope 0 at $DIR/try_identity.rs:+5:21: +5:22 let mut _6: isize; // in scope 0 at $DIR/try_identity.rs:+8:13: +8:37 let _7: T; // in scope 0 at $DIR/try_identity.rs:+8:35: +8:36 let _8: E; // in scope 0 at $DIR/try_identity.rs:+9:32: +9:33 scope 1 { - debug v => _4; // in scope 1 at $DIR/try_identity.rs:+4:20: +4:21 + debug v => _3; // in scope 1 at $DIR/try_identity.rs:+4:20: +4:21 } scope 2 { debug e => _5; // in scope 2 at $DIR/try_identity.rs:+5:21: +5:22 @@ -24,47 +24,47 @@ fn new(_1: Result) -> Result { } bb0: { - StorageLive(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10 - _3 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+3:19: +3:20 - switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+3:13: +3:20 + StorageLive(_4); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10 + _2 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+3:19: +3:20 + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb7]; // scope 0 at $DIR/try_identity.rs:+3:13: +3:20 } bb1: { - _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+5:21: +5:22 - _2 = ControlFlow::::Break(move _5); // scope 2 at $DIR/try_identity.rs:+5:27: +5:48 - goto -> bb4; // scope 0 at $DIR/try_identity.rs:+5:47: +5:48 + _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+4:20: +4:21 + _4 = ControlFlow::::Continue(move _3); // scope 1 at $DIR/try_identity.rs:+4:26: +4:50 + goto -> bb3; // scope 0 at $DIR/try_identity.rs:+4:49: +4:50 } bb2: { - unreachable; // scope 0 at $DIR/try_identity.rs:+3:19: +3:20 + _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+5:21: +5:22 + _4 = ControlFlow::::Break(move _5); // scope 2 at $DIR/try_identity.rs:+5:27: +5:48 + goto -> bb3; // scope 0 at $DIR/try_identity.rs:+5:47: +5:48 } bb3: { - _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+4:20: +4:21 - _2 = ControlFlow::::Continue(move _4); // scope 1 at $DIR/try_identity.rs:+4:26: +4:50 - goto -> bb4; // scope 0 at $DIR/try_identity.rs:+4:49: +4:50 + _6 = discriminant(_4); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10 + switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb7]; // scope 0 at $DIR/try_identity.rs:+2:9: +7:10 } bb4: { - _6 = discriminant(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10 - switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +7:10 + _7 = move ((_4 as Continue).0: T); // scope 0 at $DIR/try_identity.rs:+8:35: +8:36 + _0 = Result::::Ok(move _7); // scope 0 at $DIR/try_identity.rs:+1:5: +11:6 + StorageDead(_4); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + goto -> bb6; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 } bb5: { - _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity.rs:+9:32: +9:33 + _8 = move ((_4 as Break).0: E); // scope 0 at $DIR/try_identity.rs:+9:32: +9:33 _0 = Result::::Err(move _8); // scope 4 at $DIR/try_identity.rs:+9:45: +9:51 - StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 - goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + StorageDead(_4); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + goto -> bb6; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 } bb6: { - _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity.rs:+8:35: +8:36 - _0 = Result::::Ok(move _7); // scope 0 at $DIR/try_identity.rs:+1:5: +11:6 - StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 - goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + return; // scope 0 at $DIR/try_identity.rs:+12:2: +12:2 } bb7: { - return; // scope 0 at $DIR/try_identity.rs:+12:2: +12:2 + unreachable; // scope 0 at $DIR/try_identity.rs:+3:19: +3:20 } } diff --git a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir index e217d19947f..0487c6c3994 100644 --- a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir @@ -15,26 +15,26 @@ fn old(_1: Result) -> Result { bb0: { _2 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+2:15: +2:16 - switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +2:16 + switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4]; // scope 0 at $DIR/try_identity.rs:+2:9: +2:16 } bb1: { - _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+4:17: +4:18 - _0 = Result::::Err(move _4); // scope 2 at $DIR/try_identity.rs:+4:30: +4:36 - goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2 + _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+3:16: +3:17 + _0 = Result::::Ok(move _3); // scope 0 at $DIR/try_identity.rs:+1:5: +6:6 + goto -> bb3; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2 } bb2: { - unreachable; // scope 0 at $DIR/try_identity.rs:+2:15: +2:16 + _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+4:17: +4:18 + _0 = Result::::Err(move _4); // scope 2 at $DIR/try_identity.rs:+4:30: +4:36 + goto -> bb3; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2 } bb3: { - _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+3:16: +3:17 - _0 = Result::::Ok(move _3); // scope 0 at $DIR/try_identity.rs:+1:5: +6:6 - goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2 + return; // scope 0 at $DIR/try_identity.rs:+7:2: +7:2 } bb4: { - return; // scope 0 at $DIR/try_identity.rs:+7:2: +7:2 + unreachable; // scope 0 at $DIR/try_identity.rs:+2:15: +2:16 } } diff --git a/tests/mir-opt/tls_access.main.PreCodegen.after.mir b/tests/mir-opt/tls_access.main.PreCodegen.after.mir index 09453b8ba9c..03618ae2814 100644 --- a/tests/mir-opt/tls_access.main.PreCodegen.after.mir +++ b/tests/mir-opt/tls_access.main.PreCodegen.after.mir @@ -2,27 +2,27 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/tls_access.rs:+0:11: +0:11 - let _2: *mut u8; // in scope 0 at $DIR/tls_access.rs:+2:18: +2:21 + let _1: *mut u8; // in scope 0 at $DIR/tls_access.rs:+2:18: +2:21 let mut _3: *mut u8; // in scope 0 at $DIR/tls_access.rs:+3:9: +3:12 scope 1 { - let _1: &u8; // in scope 1 at $DIR/tls_access.rs:+2:13: +2:14 + let _2: &u8; // in scope 1 at $DIR/tls_access.rs:+2:13: +2:14 scope 2 { - debug a => _1; // in scope 2 at $DIR/tls_access.rs:+2:13: +2:14 + debug a => _2; // in scope 2 at $DIR/tls_access.rs:+2:13: +2:14 } } bb0: { - StorageLive(_1); // scope 1 at $DIR/tls_access.rs:+2:13: +2:14 - StorageLive(_2); // scope 1 at $DIR/tls_access.rs:+2:18: +2:21 - _2 = &/*tls*/ mut FOO; // scope 1 at $DIR/tls_access.rs:+2:18: +2:21 - _1 = &(*_2); // scope 1 at $DIR/tls_access.rs:+2:17: +2:21 + StorageLive(_2); // scope 1 at $DIR/tls_access.rs:+2:13: +2:14 + StorageLive(_1); // scope 1 at $DIR/tls_access.rs:+2:18: +2:21 + _1 = &/*tls*/ mut FOO; // scope 1 at $DIR/tls_access.rs:+2:18: +2:21 + _2 = &(*_1); // scope 1 at $DIR/tls_access.rs:+2:17: +2:21 StorageLive(_3); // scope 2 at $DIR/tls_access.rs:+3:9: +3:12 _3 = &/*tls*/ mut FOO; // scope 2 at $DIR/tls_access.rs:+3:9: +3:12 (*_3) = const 42_u8; // scope 2 at $DIR/tls_access.rs:+3:9: +3:17 StorageDead(_3); // scope 2 at $DIR/tls_access.rs:+3:17: +3:18 _0 = const (); // scope 1 at $DIR/tls_access.rs:+1:5: +4:6 - StorageDead(_2); // scope 1 at $DIR/tls_access.rs:+4:5: +4:6 StorageDead(_1); // scope 1 at $DIR/tls_access.rs:+4:5: +4:6 + StorageDead(_2); // scope 1 at $DIR/tls_access.rs:+4:5: +4:6 return; // scope 0 at $DIR/tls_access.rs:+5:2: +5:2 } } diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir index 811789a60c3..8922eda07ac 100644 --- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -31,18 +31,18 @@ fn while_loop(_1: bool) -> () { } bb4: { - switchInt(move _3) -> [0: bb6, otherwise: bb5]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 + switchInt(move _3) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/while_storage.rs:+2:12: +2:23 } bb5: { StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+4:9: +4:10 - goto -> bb7; // scope 0 at no-location + StorageDead(_2); // scope 0 at $DIR/while_storage.rs:+5:5: +5:6 + goto -> bb1; // scope 0 at $DIR/while_storage.rs:+1:5: +5:6 } bb6: { StorageDead(_3); // scope 0 at $DIR/while_storage.rs:+4:9: +4:10 - StorageDead(_2); // scope 0 at $DIR/while_storage.rs:+5:5: +5:6 - goto -> bb1; // scope 0 at $DIR/while_storage.rs:+1:5: +5:6 + goto -> bb7; // scope 0 at no-location } bb7: {