From 6f49aadabbd2d487f290fe393c7a69f77ebda9c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sat, 6 Mar 2021 00:00:00 +0000 Subject: [PATCH] Disable destination propagation on all mir-opt-levels --- compiler/rustc_mir/src/transform/dest_prop.rs | 5 + ..._line_doc_comment_2.DeduplicateBlocks.diff | 36 ++++--- src/test/mir-opt/dest-prop/branch.rs | 2 +- .../mir-opt/dest-prop/copy_propagation_arg.rs | 2 +- src/test/mir-opt/dest-prop/cycle.rs | 2 +- src/test/mir-opt/dest-prop/simple.rs | 2 +- src/test/mir-opt/dest-prop/union.rs | 2 +- ...line_closure_captures.foo.Inline.after.mir | 12 ++- .../inline/inline_diverging.h.Inline.diff | 17 ++-- .../inline/inline_generator.main.Inline.diff | 41 +++++--- .../issue_73223.main.PreCodegen.32bit.diff | 98 ++++++++++++------- .../issue_73223.main.PreCodegen.64bit.diff | 98 ++++++++++++------- ...ue_59352.num_to_digit.PreCodegen.after.mir | 79 ++++++++------- ...wer_intrinsics.f_u64.PreCodegen.before.mir | 4 +- .../simplify_locals.c.SimplifyLocals.diff | 7 +- 15 files changed, 260 insertions(+), 147 deletions(-) diff --git a/compiler/rustc_mir/src/transform/dest_prop.rs b/compiler/rustc_mir/src/transform/dest_prop.rs index 0822ab73c4c67..f7568e1d929dd 100644 --- a/compiler/rustc_mir/src/transform/dest_prop.rs +++ b/compiler/rustc_mir/src/transform/dest_prop.rs @@ -127,6 +127,11 @@ pub struct DestinationPropagation; impl<'tcx> MirPass<'tcx> for DestinationPropagation { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { + // FIXME(#79191, #82678) + if !tcx.sess.opts.debugging_opts.unsound_mir_opts { + return; + } + // Only run at mir-opt-level=3 or higher for now (we don't fix up debuginfo and remove // storage statements at the moment). if tcx.sess.mir_opt_level() < 3 { diff --git a/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff b/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff index b6e4469e87069..b0c97f4237818 100644 --- a/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff +++ b/src/test/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff @@ -5,22 +5,26 @@ debug s => _1; // in scope 0 at $DIR/deduplicate_blocks.rs:2:36: 2:37 let mut _0: bool; // return place in scope 0 at $DIR/deduplicate_blocks.rs:2:48: 2:52 let mut _2: &[u8]; // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23 - let mut _3: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 - let mut _4: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 - let mut _5: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 - let mut _6: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 + let mut _3: &str; // in scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12 + let mut _4: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 + let mut _5: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 + let mut _6: usize; // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 + let mut _7: bool; // in scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 scope 1 (inlined core::str::::as_bytes) { // at $DIR/deduplicate_blocks.rs:3:11: 3:23 - debug self => _7; // in scope 1 at $DIR/deduplicate_blocks.rs:3:11: 3:23 - let mut _7: &str; // in scope 1 at $DIR/deduplicate_blocks.rs:3:11: 3:23 + debug self => _3; // in scope 1 at $DIR/deduplicate_blocks.rs:3:11: 3:23 + let mut _8: &str; // in scope 1 at $DIR/deduplicate_blocks.rs:3:11: 3:23 scope 2 { } } bb0: { StorageLive(_2); // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:23 - _7 = _1; // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12 -- _2 = transmute::<&str, &[u8]>(move _7) -> bb14; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 -+ _2 = transmute::<&str, &[u8]>(move _7) -> bb12; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 + StorageLive(_3); // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12 + _3 = _1; // scope 0 at $DIR/deduplicate_blocks.rs:3:11: 3:12 + StorageLive(_8); // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 + _8 = _3; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 +- _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 ++ _2 = transmute::<&str, &[u8]>(move _8) -> bb12; // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 // mir::Constant // + span: $DIR/deduplicate_blocks.rs:3:11: 3:23 // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&str) -> &[u8] {std::intrinsics::transmute::<&str, &[u8]>}, val: Value(Scalar()) } @@ -44,9 +48,9 @@ } bb5: { - _3 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 - _4 = Ge(move _3, const 3_usize); // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 - switchInt(move _4) -> [false: bb9, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 + _4 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 + _5 = Ge(move _4, const 3_usize); // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 + switchInt(move _5) -> [false: bb9, otherwise: bb6]; // scope 0 at $DIR/deduplicate_blocks.rs:5:9: 5:31 } bb6: { @@ -93,9 +97,11 @@ - bb14: { + bb12: { - _5 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 - _6 = Ge(move _5, const 4_usize); // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 - switchInt(move _6) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 + StorageDead(_8); // scope 2 at $DIR/deduplicate_blocks.rs:3:11: 3:23 + StorageDead(_3); // scope 0 at $DIR/deduplicate_blocks.rs:3:22: 3:23 + _6 = Len((*_2)); // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 + _7 = Ge(move _6, const 4_usize); // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 + switchInt(move _7) -> [false: bb5, otherwise: bb1]; // scope 0 at $DIR/deduplicate_blocks.rs:4:9: 4:37 } } diff --git a/src/test/mir-opt/dest-prop/branch.rs b/src/test/mir-opt/dest-prop/branch.rs index 7e0e40671ddb2..fffcf82b3f1d8 100644 --- a/src/test/mir-opt/dest-prop/branch.rs +++ b/src/test/mir-opt/dest-prop/branch.rs @@ -1,5 +1,5 @@ //! Tests that assignment in both branches of an `if` are eliminated. - +// compile-flags: -Zunsound-mir-opts fn val() -> i32 { 1 } diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.rs b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs index b5188a8b4b260..41796247789aa 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs @@ -1,6 +1,6 @@ // Check that DestinationPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) - +// compile-flags: -Zunsound-mir-opts fn dummy(x: u8) -> u8 { x } diff --git a/src/test/mir-opt/dest-prop/cycle.rs b/src/test/mir-opt/dest-prop/cycle.rs index 7fbffb1335946..c9187d408675c 100644 --- a/src/test/mir-opt/dest-prop/cycle.rs +++ b/src/test/mir-opt/dest-prop/cycle.rs @@ -1,5 +1,5 @@ //! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code. - +// compile-flags: -Zunsound-mir-opts fn val() -> i32 { 1 } diff --git a/src/test/mir-opt/dest-prop/simple.rs b/src/test/mir-opt/dest-prop/simple.rs index 4655f96699874..3627d479a9aa3 100644 --- a/src/test/mir-opt/dest-prop/simple.rs +++ b/src/test/mir-opt/dest-prop/simple.rs @@ -1,5 +1,5 @@ //! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too. - +// compile-flags: -Zunsound-mir-opts // EMIT_MIR simple.nrvo.DestinationPropagation.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { let mut buf = [0; 1024]; diff --git a/src/test/mir-opt/dest-prop/union.rs b/src/test/mir-opt/dest-prop/union.rs index b9d831389e8b3..0ac9661a66a31 100644 --- a/src/test/mir-opt/dest-prop/union.rs +++ b/src/test/mir-opt/dest-prop/union.rs @@ -1,5 +1,5 @@ //! Tests that projections through unions cancel `DestinationPropagation`. - +// compile-flags: -Zunsound-mir-opts fn val() -> u32 { 1 } diff --git a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index a861eab39d337..a7c2c93aad23a 100644 --- a/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -17,7 +17,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) { debug _q => _9; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 - let mut _10: T; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + let mut _10: i32; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + let mut _11: T; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 } } @@ -39,10 +40,13 @@ fn foo(_1: T, _2: i32) -> (i32, T) { (_7.0: i32) = move _8; // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageLive(_9); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 _9 = move (_7.0: i32); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 - (_0.0: i32) = (*((*_6).0: &i32)); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageLive(_10); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 - _10 = (*((*_6).1: &T)); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 - (_0.1: T) = move _10; // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + _10 = (*((*_6).0: &i32)); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + StorageLive(_11); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + _11 = (*((*_6).1: &T)); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + (_0.0: i32) = move _10; // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + (_0.1: T) = move _11; // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 + StorageDead(_11); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageDead(_10); // scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageDead(_9); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9 StorageDead(_8); // scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9 diff --git a/src/test/mir-opt/inline/inline_diverging.h.Inline.diff b/src/test/mir-opt/inline/inline_diverging.h.Inline.diff index e945629b6138b..e2fad5b60ebfa 100644 --- a/src/test/mir-opt/inline/inline_diverging.h.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.h.Inline.diff @@ -5,18 +5,20 @@ let mut _0: (); // return place in scope 0 at $DIR/inline-diverging.rs:21:12: 21:12 let _1: (!, !); // in scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 + let mut _2: fn() -> ! {sleep}; // in scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 -+ let mut _7: (); // in scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 -+ let mut _8: (); // in scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 ++ let mut _9: (); // in scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 ++ let mut _10: (); // in scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 + 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:22:5: 22:22 + let _3: !; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 + let mut _4: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 -+ let mut _5: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 -+ let mut _6: !; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 ++ let mut _6: &fn() -> ! {sleep}; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 ++ let mut _7: !; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 ++ let mut _8: !; // in scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 + scope 2 { + debug a => _3; // in scope 2 at $DIR/inline-diverging.rs:22:5: 22:22 ++ let _5: !; // in scope 2 at $DIR/inline-diverging.rs:22:5: 22:22 + scope 3 { -+ debug b => _6; // in scope 3 at $DIR/inline-diverging.rs:22:5: 22:22 ++ debug b => _5; // in scope 3 at $DIR/inline-diverging.rs:22:5: 22:22 + } + scope 6 (inlined ! {sleep} as Fn<()>>::call - shim(fn() -> ! {sleep})) { // at $DIR/inline-diverging.rs:22:5: 22:22 + scope 7 (inlined sleep) { // at $DIR/inline-diverging.rs:22:5: 22:22 @@ -40,12 +42,11 @@ - // mir::Constant // + span: $DIR/inline-diverging.rs:22:16: 22:21 // + literal: Const { ty: fn() -> ! {sleep}, val: Value(Scalar()) } -+ StorageLive(_6); // scope 0 at $DIR/inline-diverging.rs:22:5: 22:22 + StorageLive(_3); // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 + StorageLive(_4); // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 + _4 = &_2; // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 -+ StorageLive(_7); // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 -+ _7 = const (); // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 ++ StorageLive(_9); // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 ++ _9 = const (); // scope 1 at $DIR/inline-diverging.rs:22:5: 22:22 + goto -> bb1; // scope 4 at $DIR/inline-diverging.rs:22:5: 22:22 } diff --git a/src/test/mir-opt/inline/inline_generator.main.Inline.diff b/src/test/mir-opt/inline/inline_generator.main.Inline.diff index 066ac8d82d36b..fba88c83eb4f3 100644 --- a/src/test/mir-opt/inline/inline_generator.main.Inline.diff +++ b/src/test/mir-opt/inline/inline_generator.main.Inline.diff @@ -24,9 +24,12 @@ + } + } + scope 6 (inlined g::{closure#0}) { // at $DIR/inline-generator.rs:9:14: 9:46 -+ debug a => _8; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 -+ let mut _8: bool; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 -+ let mut _9: u32; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ debug a => _11; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ let mut _8: i32; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ let mut _9: bool; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ let mut _10: bool; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ let _11: bool; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ let mut _12: u32; // in scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + } bb0: { @@ -65,16 +68,18 @@ - // + literal: Const { ty: for<'r> fn(std::pin::Pin<&'r mut impl std::ops::Generator>, bool) -> std::ops::GeneratorState< as std::ops::Generator>::Yield, as std::ops::Generator>::Return> { as std::ops::Generator>::resume}, val: Value(Scalar()) } + StorageLive(_7); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 + _7 = const false; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 -+ StorageLive(_8); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 -+ StorageLive(_9); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 -+ _9 = discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41 {bool, i32}]))); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 -+ switchInt(move _9) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageLive(_10); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageLive(_11); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageLive(_12); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 ++ _12 = discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41 {bool, i32}]))); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 } - bb3: { + bb1: { -+ StorageDead(_9); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 -+ StorageDead(_8); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageDead(_12); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageDead(_11); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageDead(_10); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 + StorageDead(_7); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 StorageDead(_2); // scope 0 at $DIR/inline-generator.rs:9:45: 9:46 StorageDead(_4); // scope 0 at $DIR/inline-generator.rs:9:46: 9:47 @@ -89,28 +94,36 @@ + } + + bb3: { -+ _8 = move _7; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 -+ switchInt(move _8) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ _11 = move _7; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageLive(_9); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ _9 = _11; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ switchInt(move _9) -> [false: bb5, otherwise: bb4]; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + } + + bb4: { -+ ((_1 as Yielded).0: i32) = const 7_i32; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ _8 = const 7_i32; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + goto -> bb6; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + } + + bb5: { -+ ((_1 as Yielded).0: i32) = const 13_i32; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ _8 = const 13_i32; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + goto -> bb6; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + } + + bb6: { ++ StorageDead(_9); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + discriminant(_1) = 0; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41 {bool, i32}]))) = 3; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:11: 15:39 + } + + bb7: { -+ ((_1 as Complete).0: bool) = move _7; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ _10 = move _7; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ StorageDead(_8); // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 ++ ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + discriminant(_1) = 1; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + discriminant((*(_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41 {bool, i32}]))) = 1; // scope 6 at $DIR/inline-generator.rs:9:14: 9:46 + goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:41: 15:41 diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff index c630ab70de13b..e2ec0e82ebf09 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -6,25 +6,32 @@ let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14 let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30 let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _13: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _5: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 + let mut _6: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _7: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _8: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _11: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _16: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _19: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + let _9: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _10: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { - debug left_val => _11; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _12; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _10: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug left_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _10; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _14: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug kind => _10; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug kind => _14; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -43,36 +50,57 @@ _1 = _3; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - ((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + StorageLive(_4); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + StorageLive(_5); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + _5 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + ((_4 as Some).0: i32) = move _5; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - (_5.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _6 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_5); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - (_5.1: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _9 = (*_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _8 = Eq(move _9, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = Not(move _8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _7) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (_6.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = (_6.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = (*_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = Eq(move _13, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = Not(move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _11) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_10) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_13) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _11, move _12, move _13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_14) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = _16; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = _10; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_19) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } @@ -85,8 +113,12 @@ } bb2: { - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 + StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index c630ab70de13b..e2ec0e82ebf09 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -6,25 +6,32 @@ let _1: i32; // in scope 0 at $DIR/issue-73223.rs:2:9: 2:14 let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:2:23: 2:30 let _3: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - let mut _5: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _6: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _7: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _9: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _12: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _13: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _5: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 + let mut _6: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _7: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _8: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _11: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _13: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _16: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _18: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _19: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 let _4: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { debug _prev => _4; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + let _9: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _10: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _20: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 4 { - debug left_val => _11; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _12; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _10: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug left_val => _9; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _10; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _14: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug kind => _10; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug kind => _14; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } } } @@ -43,36 +50,57 @@ _1 = _3; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_3); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - ((_4 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + StorageLive(_4); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + StorageLive(_5); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + _5 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + ((_4 as Some).0: i32) = move _5; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 discriminant(_4) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - (_5.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _6 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_5); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _20 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &i32 // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &i32, val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main), const_param_did: None }, [], Some(promoted[0])) } - (_5.1: &i32) = move _6; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _11 = (_5.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _12 = (_5.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _9 = (*_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _8 = Eq(move _9, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = Not(move _8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _7) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _8 = _20; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_6.0: &i32) = move _7; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_6.1: &i32) = move _8; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_7); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _9 = (_6.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _10 = (_6.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _13 = (*_9); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _12 = Eq(move _13, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = Not(move _12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(move _11) -> [false: bb2, otherwise: bb1]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageLive(_10); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_10) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_13) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _11, move _12, move _13); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_14) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_15); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = _9; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = _16; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_17); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_18); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _18 = _10; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = _18; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + discriminant(_19) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _15, move _17, move _19); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, std::option::Option>) -> ! {core::panicking::assert_failed::}, val: Value(Scalar()) } @@ -85,8 +113,12 @@ } bb2: { - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_11); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 + StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 0f718a720f4cc..19d161ac2b103 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -3,60 +3,67 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; // in scope 0 at $DIR/issue-59352.rs:12:21: 12:24 let mut _0: u32; // return place in scope 0 at $DIR/issue-59352.rs:12:35: 12:38 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:41 - let mut _3: char; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29 - let mut _4: u32; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - let mut _9: isize; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _2: char; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:11 + let mut _3: std::option::Option; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:41 + let mut _4: char; // in scope 0 at $DIR/issue-59352.rs:14:26: 14:29 + let mut _5: u32; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _11: isize; // in scope 0 at $DIR/issue-59352.rs:14:8: 14:23 scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue-59352.rs:14:8: 14:23 - debug self => _7; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - debug radix => _4; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - let mut _5: &std::option::Option; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - let _6: std::option::Option; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - let mut _7: char; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + debug self => _2; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + debug radix => _5; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _6: &std::option::Option; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + let _7: std::option::Option; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _8: char; // in scope 1 at $DIR/issue-59352.rs:14:8: 14:23 scope 2 (inlined Option::::is_some) { // at $DIR/issue-59352.rs:14:8: 14:23 - debug self => _5; // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + debug self => _6; // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + let mut _9: isize; // in scope 2 at $DIR/issue-59352.rs:14:8: 14:23 } } scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue-59352.rs:14:26: 14:50 - debug self => _2; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - let mut _8: isize; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + debug self => _3; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + let mut _10: isize; // in scope 3 at $DIR/issue-59352.rs:14:26: 14:50 scope 4 { debug val => _0; // in scope 4 at $DIR/issue-59352.rs:14:26: 14:50 } } bb0: { - _7 = _1; // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 - StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - _4 = const 8_u32; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - StorageLive(_5); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 + _2 = _1; // scope 0 at $DIR/issue-59352.rs:14:8: 14:11 + StorageLive(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + _5 = const 8_u32; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_6); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - _6 = char::methods::::to_digit(move _7, const 8_u32) -> bb5; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_8); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _8 = _2; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _7 = char::methods::::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 // mir::Constant // + span: $DIR/issue-59352.rs:14:8: 14:23 // + literal: Const { ty: fn(char, u32) -> std::option::Option {std::char::methods::::to_digit}, val: Value(Scalar()) } } bb1: { - StorageLive(_2); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 - StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 - _3 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 - _2 = char::methods::::to_digit(move _3, const 8_u32) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 + StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 + StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 + _4 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 + _3 = char::methods::::to_digit(move _4, const 8_u32) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 // mir::Constant // + span: $DIR/issue-59352.rs:14:30: 14:38 // + literal: Const { ty: fn(char, u32) -> std::option::Option {std::char::methods::::to_digit}, val: Value(Scalar()) } } bb2: { + StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } bb3: { - StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 - StorageLive(_8); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - _8 = discriminant(_2); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - switchInt(move _8) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 + StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + _10 = discriminant(_3); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 } bb4: { @@ -64,12 +71,18 @@ fn num_to_digit(_1: char) -> u32 { } bb5: { - _5 = &_6; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - _9 = discriminant((*_5)); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 - StorageDead(_5); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _6 = &_7; // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_8); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_9); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + _9 = discriminant((*_6)); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + StorageLive(_11); // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + _11 = move _9; // scope 2 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_9); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_6); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 - StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 - switchInt(move _9) -> [1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + StorageDead(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:22: 14:23 + switchInt(move _11) -> [1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } bb6: { @@ -90,9 +103,9 @@ fn num_to_digit(_1: char) -> u32 { } bb8: { - _0 = move ((_2 as Some).0: u32); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 - StorageDead(_8); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 - StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 + _0 = move ((_3 as Some).0: u32); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 + StorageDead(_3); // scope 0 at $DIR/issue-59352.rs:14:49: 14:50 goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 } } diff --git a/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir b/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir index 740a6e0edb0c4..a87d5e1f0ff8b 100644 --- a/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir +++ b/src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir @@ -2,9 +2,9 @@ fn f_u64() -> () { let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:16 + let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 scope 1 (inlined f_dispatch::) { // at $DIR/lower_intrinsics.rs:35:5: 35:21 debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 - let mut _1: u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 let mut _3: u64; // in scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 scope 2 (inlined std::mem::size_of::) { // at $DIR/lower_intrinsics.rs:35:5: 35:21 @@ -12,6 +12,7 @@ fn f_u64() -> () { } bb0: { + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 _1 = const 0_u64; // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 @@ -25,6 +26,7 @@ fn f_u64() -> () { bb1: { StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21 + StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21 _0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 36:2 return; // scope 0 at $DIR/lower_intrinsics.rs:36:2: 36:2 } diff --git a/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff index dbac7dff9e2bb..f1718c5752c1c 100644 --- a/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff @@ -17,8 +17,13 @@ StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:14:9: 14:14 _1 = [const 0_u8; 10]; // scope 0 at $DIR/simplify-locals.rs:14:17: 14:26 - StorageLive(_2); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 -- _3 = &_1; // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 +- StorageLive(_3); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 +- StorageLive(_4); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 +- _4 = &_1; // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 +- _3 = _4; // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 - _2 = move _3 as &[u8] (Pointer(Unsize)); // scope 1 at $DIR/simplify-locals.rs:16:20: 16:26 +- StorageDead(_3); // scope 1 at $DIR/simplify-locals.rs:16:25: 16:26 +- StorageDead(_4); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27 - StorageDead(_2); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27 _0 = const (); // scope 0 at $DIR/simplify-locals.rs:13:8: 17:2 StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:17:1: 17:2