From eb3eb8547696c984a47157ebfe9dd35d292ef2d7 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Fri, 18 Sep 2020 20:14:27 -0400 Subject: [PATCH 1/2] [mir-opt] Introduce a new flag to enable experimental/unsound mir opts --- compiler/rustc_mir/src/transform/copy_prop.rs | 4 +- .../rustc_mir/src/transform/simplify_try.rs | 6 +- compiler/rustc_session/src/options.rs | 2 + src/test/mir-opt/copy_propagation.rs | 1 + ...copy_propagation.test.CopyPropagation.diff | 18 ++-- .../mir-opt/early_otherwise_branch_68867.rs | 2 +- src/test/mir-opt/inline/inline-any-operand.rs | 2 +- .../inline/inline-closure-borrows-arg.rs | 2 +- .../mir-opt/inline/inline-trait-method_2.rs | 2 +- src/test/mir-opt/issue-73223.rs | 2 + .../issue_73223.main.PreCodegen.32bit.diff | 32 +++--- .../issue_73223.main.PreCodegen.64bit.diff | 32 +++--- ..._73223.main.SimplifyArmIdentity.32bit.diff | 76 ++++++------- ..._73223.main.SimplifyArmIdentity.64bit.diff | 76 ++++++------- src/test/mir-opt/nrvo-simple.rs | 2 +- ...ocals-removes-unused-discriminant-reads.rs | 2 + ...minant_reads.map.SimplifyLocals.32bit.diff | 30 +++--- ...minant_reads.map.SimplifyLocals.64bit.diff | 30 +++--- src/test/mir-opt/simplify_try.rs | 1 + ...y.try_identity.DestinationPropagation.diff | 70 ++++++------ ..._try.try_identity.SimplifyArmIdentity.diff | 102 +++++++++--------- ....try_identity.SimplifyBranchSame.after.mir | 56 +++++----- ..._try.try_identity.SimplifyLocals.after.mir | 14 +-- 23 files changed, 287 insertions(+), 277 deletions(-) diff --git a/compiler/rustc_mir/src/transform/copy_prop.rs b/compiler/rustc_mir/src/transform/copy_prop.rs index ba406c72df848..74194467b38c5 100644 --- a/compiler/rustc_mir/src/transform/copy_prop.rs +++ b/compiler/rustc_mir/src/transform/copy_prop.rs @@ -31,9 +31,11 @@ pub struct CopyPropagation; impl<'tcx> MirPass<'tcx> for CopyPropagation { fn run_pass(&self, tcx: TyCtxt<'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { + let opts = &tcx.sess.opts.debugging_opts; // We only run when the MIR optimization level is > 1. // This avoids a slow pass, and messing up debug info. - if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 { + // FIXME(76740): This optimization is buggy and can cause unsoundness. + if opts.mir_opt_level <= 1 || !opts.unsound_mir_opts { return; } diff --git a/compiler/rustc_mir/src/transform/simplify_try.rs b/compiler/rustc_mir/src/transform/simplify_try.rs index 9a11d92724020..ec0ba25a28a20 100644 --- a/compiler/rustc_mir/src/transform/simplify_try.rs +++ b/compiler/rustc_mir/src/transform/simplify_try.rs @@ -612,7 +612,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> { && bb_l.terminator().kind == bb_r.terminator().kind; let statement_check = || { bb_l.statements.iter().zip(&bb_r.statements).try_fold(StatementEquality::TrivialEqual, |acc,(l,r)| { - let stmt_equality = self.statement_equality(*adt_matched_on, &l, bb_l_idx, &r, bb_r_idx, self.tcx.sess.opts.debugging_opts.mir_opt_level); + let stmt_equality = self.statement_equality(*adt_matched_on, &l, bb_l_idx, &r, bb_r_idx, self.tcx); if matches!(stmt_equality, StatementEquality::NotEqual) { // short circuit None @@ -672,7 +672,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> { x_bb_idx: BasicBlock, y: &Statement<'tcx>, y_bb_idx: BasicBlock, - mir_opt_level: usize, + tcx: TyCtxt<'tcx>, ) -> StatementEquality { let helper = |rhs: &Rvalue<'tcx>, place: &Place<'tcx>, @@ -693,7 +693,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> { Rvalue::Use(operand) if operand.place() == Some(adt_matched_on) => { // FIXME(76803): This logic is currently broken because it does not take into // account the current discriminant value. - if mir_opt_level > 2 { + if tcx.sess.opts.debugging_opts.unsound_mir_opts { StatementEquality::ConsideredEqual(side_to_choose) } else { StatementEquality::NotEqual diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 8cc55f4ebe895..712c9cb87c9d5 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1115,6 +1115,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, `hir,typed` (HIR with types for each node), `hir-tree` (dump the raw HIR), `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"), + unsound_mir_opts: bool = (false, parse_bool, [TRACKED], + "enable unsound and buggy MIR optimizations (default: no)"), unstable_options: bool = (false, parse_bool, [UNTRACKED], "adds unstable command line options to rustc interface (default: no)"), use_ctors_section: Option = (None, parse_opt_bool, [TRACKED], diff --git a/src/test/mir-opt/copy_propagation.rs b/src/test/mir-opt/copy_propagation.rs index ee460a488b675..8283ec73d0f07 100644 --- a/src/test/mir-opt/copy_propagation.rs +++ b/src/test/mir-opt/copy_propagation.rs @@ -1,3 +1,4 @@ +// compile-flags: -Zunsound-mir-opts // EMIT_MIR copy_propagation.test.CopyPropagation.diff fn test(x: u32) -> u32 { diff --git a/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff b/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff index 1f3e559c1b7f4..152d159063052 100644 --- a/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff +++ b/src/test/mir-opt/copy_propagation.test.CopyPropagation.diff @@ -2,19 +2,19 @@ + // MIR for `test` after CopyPropagation fn test(_1: u32) -> u32 { - debug x => _1; // in scope 0 at $DIR/copy_propagation.rs:3:9: 3:10 - let mut _0: u32; // return place in scope 0 at $DIR/copy_propagation.rs:3:20: 3:23 - let _2: u32; // in scope 0 at $DIR/copy_propagation.rs:4:9: 4:10 + debug x => _1; // in scope 0 at $DIR/copy_propagation.rs:4:9: 4:10 + let mut _0: u32; // return place in scope 0 at $DIR/copy_propagation.rs:4:20: 4:23 + let _2: u32; // in scope 0 at $DIR/copy_propagation.rs:5:9: 5:10 scope 1 { - debug y => _0; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10 + debug y => _0; // in scope 1 at $DIR/copy_propagation.rs:5:9: 5:10 } bb0: { - nop; // scope 0 at $DIR/copy_propagation.rs:4:9: 4:10 - _0 = _1; // scope 0 at $DIR/copy_propagation.rs:4:13: 4:14 - nop; // scope 1 at $DIR/copy_propagation.rs:5:5: 5:6 - nop; // scope 0 at $DIR/copy_propagation.rs:6:1: 6:2 - return; // scope 0 at $DIR/copy_propagation.rs:6:2: 6:2 + nop; // scope 0 at $DIR/copy_propagation.rs:5:9: 5:10 + _0 = _1; // scope 0 at $DIR/copy_propagation.rs:5:13: 5:14 + nop; // scope 1 at $DIR/copy_propagation.rs:6:5: 6:6 + nop; // scope 0 at $DIR/copy_propagation.rs:7:1: 7:2 + return; // scope 0 at $DIR/copy_propagation.rs:7:2: 7:2 } } diff --git a/src/test/mir-opt/early_otherwise_branch_68867.rs b/src/test/mir-opt/early_otherwise_branch_68867.rs index 5922e73e5d205..98a275c18acdc 100644 --- a/src/test/mir-opt/early_otherwise_branch_68867.rs +++ b/src/test/mir-opt/early_otherwise_branch_68867.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -// compile-flags: -Z mir-opt-level=3 +// compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts // example from #68867 type CSSFloat = f32; diff --git a/src/test/mir-opt/inline/inline-any-operand.rs b/src/test/mir-opt/inline/inline-any-operand.rs index fb0de020f73a2..feac14eccd85f 100644 --- a/src/test/mir-opt/inline/inline-any-operand.rs +++ b/src/test/mir-opt/inline/inline-any-operand.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats +// compile-flags: -Z span_free_formats -Zunsound-mir-opts // Tests that MIR inliner works for any operand diff --git a/src/test/mir-opt/inline/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline/inline-closure-borrows-arg.rs index 218bc3553a139..d76bc33f52e7d 100644 --- a/src/test/mir-opt/inline/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline/inline-closure-borrows-arg.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats +// compile-flags: -Z span_free_formats -Zunsound-mir-opts // Tests that MIR inliner can handle closure arguments, // even when (#45894) diff --git a/src/test/mir-opt/inline/inline-trait-method_2.rs b/src/test/mir-opt/inline/inline-trait-method_2.rs index 6e5de8315a1cb..9626ba123aadb 100644 --- a/src/test/mir-opt/inline/inline-trait-method_2.rs +++ b/src/test/mir-opt/inline/inline-trait-method_2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats -Z mir-opt-level=3 +// compile-flags: -Z span_free_formats -Z mir-opt-level=3 -Zunsound-mir-opts // EMIT_MIR inline_trait_method_2.test2.Inline.after.mir fn test2(x: &dyn X) -> bool { diff --git a/src/test/mir-opt/issue-73223.rs b/src/test/mir-opt/issue-73223.rs index 703b876123133..5372b6fe024d2 100644 --- a/src/test/mir-opt/issue-73223.rs +++ b/src/test/mir-opt/issue-73223.rs @@ -1,3 +1,5 @@ +// compile-flags: -Zunsound-mir-opts + fn main() { let split = match Some(1) { Some(v) => v, 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 a8662b96566cc..72582ed716cb0 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -2,9 +2,9 @@ + // MIR for `main` after PreCodegen fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 - 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 mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 + let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 + let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 let mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -20,10 +20,10 @@ let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 - let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 + let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 scope 3 { - debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -55,7 +55,7 @@ } } scope 2 { - debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 + debug v => _1; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 } scope 7 { } @@ -63,13 +63,13 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 + ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 + discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 (_4.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_4.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const @@ -93,8 +93,8 @@ bb1: { StorageDead(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 - return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 + return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 } bb2: { 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 a8662b96566cc..72582ed716cb0 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -2,9 +2,9 @@ + // MIR for `main` after PreCodegen fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 - 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 mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 + let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 + let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 let mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -20,10 +20,10 @@ let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 - let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 + let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 scope 3 { - debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 scope 4 { debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -55,7 +55,7 @@ } } scope 2 { - debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 + debug v => _1; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 } scope 7 { } @@ -63,13 +63,13 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 + ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 + discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 (_4.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL (_4.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const @@ -93,8 +93,8 @@ bb1: { StorageDead(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 - return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 + return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 } bb2: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index 302612f5a0a28..d41d121430106 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -2,18 +2,18 @@ + // MIR for `main` after SimplifyArmIdentity fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 - 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 mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:3:9: 3:16 - let _4: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:4:17: 4:23 - let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 + let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 + let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 + let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + let mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:5:9: 5:16 + let _4: i32; // in scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:6:17: 6:23 + let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:9:22: 9:27 let _8: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: &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 _12: i32; // in scope 0 at $DIR/issue-73223.rs:8:23: 8:24 + let _12: i32; // in scope 0 at $DIR/issue-73223.rs:10:23: 10:24 let mut _15: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _16: bool; // 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 @@ -42,10 +42,10 @@ let mut _42: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _43: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 - let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 + let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 scope 3 { - debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _45: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -86,7 +86,7 @@ } } scope 2 { - debug v => _4; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 + debug v => _4; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 } scope 7 { } @@ -94,33 +94,33 @@ } bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:9: 2:14 - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 - goto -> bb2; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 + StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:4:9: 4:14 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 + goto -> bb2; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 } bb1: { - _0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 } bb2: { - StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - _1 = _4; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 - StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - _7 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 + StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + _1 = _4; // scope 2 at $DIR/issue-73223.rs:5:20: 5:21 + StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:5:20: 5:21 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 + StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:9:9: 9:14 + StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 + _7 = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 + ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 + discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 + StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:9:27: 9:28 StorageLive(_8); // 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 StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -157,7 +157,7 @@ } bb3: { - return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 + return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 } bb4: { @@ -167,10 +167,10 @@ StorageDead(_13); // 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(_8); // 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(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 + StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:11:1: 11:2 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 } bb5: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index 302612f5a0a28..d41d121430106 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -2,18 +2,18 @@ + // MIR for `main` after SimplifyArmIdentity fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 - 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 mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:3:9: 3:16 - let _4: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:4:17: 4:23 - let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 + let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 + let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 + let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + let mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:5:9: 5:16 + let _4: i32; // in scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:6:17: 6:23 + let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:9:22: 9:27 let _8: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: &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 _12: i32; // in scope 0 at $DIR/issue-73223.rs:8:23: 8:24 + let _12: i32; // in scope 0 at $DIR/issue-73223.rs:10:23: 10:24 let mut _15: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _16: bool; // 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 @@ -42,10 +42,10 @@ let mut _42: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _43: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 - let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 + let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 scope 3 { - debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 + debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _45: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -86,7 +86,7 @@ } } scope 2 { - debug v => _4; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 + debug v => _4; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 } scope 7 { } @@ -94,33 +94,33 @@ } bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:9: 2:14 - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 - _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 - goto -> bb2; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 + StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:4:9: 4:14 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 + goto -> bb2; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 } bb1: { - _0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 } bb2: { - StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 - _1 = _4; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 - StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 - StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - _7 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 - ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 - StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 + StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 + _1 = _4; // scope 2 at $DIR/issue-73223.rs:5:20: 5:21 + StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:5:20: 5:21 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 + StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:9:9: 9:14 + StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 + _7 = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 + ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 + discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 + StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:9:27: 9:28 StorageLive(_8); // 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 StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -157,7 +157,7 @@ } bb3: { - return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 + return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 } bb4: { @@ -167,10 +167,10 @@ StorageDead(_13); // 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(_8); // 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(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 + StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:11:1: 11:2 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 } bb5: { diff --git a/src/test/mir-opt/nrvo-simple.rs b/src/test/mir-opt/nrvo-simple.rs index ab46d7b94c72c..22b18b107701e 100644 --- a/src/test/mir-opt/nrvo-simple.rs +++ b/src/test/mir-opt/nrvo-simple.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zmir-opt-level=1 +// compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts // EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { diff --git a/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs b/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs index cf8940ec33096..84f57deccf7e0 100644 --- a/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs +++ b/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs @@ -1,3 +1,5 @@ +// compile-flags: -Zunsound-mir-opts + fn map(x: Option>) -> Option> { match x { None => None, diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff index 68a113f94efda..760fb747f7229 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff @@ -2,25 +2,25 @@ + // MIR for `map` after SimplifyLocals fn map(_1: Option>) -> Option> { - debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:8: 1:9 - let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:31: 1:46 -- let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 -- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 -- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:25: 4:26 -- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 -- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 -- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 + debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:8: 3:9 + let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:31: 3:46 +- let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 +- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 +- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:25: 6:26 +- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 +- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 +- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 scope 1 { - debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 + debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 } bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 -- _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 - _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:20: 4:27 -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 - return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:2: 6:2 +- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 +- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 +- _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 + _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:20: 6:27 +- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 + return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:2: 8:2 } } diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff index 68a113f94efda..760fb747f7229 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff @@ -2,25 +2,25 @@ + // MIR for `map` after SimplifyLocals fn map(_1: Option>) -> Option> { - debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:8: 1:9 - let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:31: 1:46 -- let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 -- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 -- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:25: 4:26 -- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 -- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 -- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 + debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:8: 3:9 + let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:31: 3:46 +- let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 +- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 +- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:25: 6:26 +- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 +- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 +- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 scope 1 { - debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 + debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 } bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 -- _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 - _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:20: 4:27 -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 - return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:2: 6:2 +- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 +- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 +- _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 + _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:20: 6:27 +- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 + return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:2: 8:2 } } diff --git a/src/test/mir-opt/simplify_try.rs b/src/test/mir-opt/simplify_try.rs index fca80bee89679..eb307de20744a 100644 --- a/src/test/mir-opt/simplify_try.rs +++ b/src/test/mir-opt/simplify_try.rs @@ -1,3 +1,4 @@ +// compile-flags: -Zunsound-mir-opts // EMIT_MIR simplify_try.try_identity.SimplifyArmIdentity.diff // EMIT_MIR simplify_try.try_identity.SimplifyBranchSame.after.mir // EMIT_MIR simplify_try.try_identity.SimplifyLocals.after.mir diff --git a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff index 187a3cfbb896d..b3a2b6fbf76b2 100644 --- a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff +++ b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff @@ -2,35 +2,35 @@ + // MIR for `try_identity` after DestinationPropagation fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 - let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10 - let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14 - let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 + let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 + let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let _6: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let _10: u32; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:9:8: 9:9 scope 1 { - debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 } scope 2 { - debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 + debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 scope 3 { scope 7 { debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } scope 8 { debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15 } } } scope 4 { - debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 + debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 scope 5 { } } @@ -40,33 +40,33 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10 -- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 -- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 -- _4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:8:9: 8:10 +- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 +- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 +- _4 = _1; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 - _3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 -- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 -+ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 -+ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 -+ _0 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 +- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 +- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 ++ nop; // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 ++ nop; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 ++ _0 = _1; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + nop; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -+ nop; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 -+ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - goto -> bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 ++ nop; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 ++ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + goto -> bb1; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 } bb1: { -- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 -- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 -+ nop; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 -+ nop; // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 - goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 +- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 +- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 ++ nop; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 ++ nop; // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 + goto -> bb2; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 } bb2: { - return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 + return; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff index 0c687684c508e..14a4318c1bc6f 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff @@ -2,25 +2,25 @@ + // MIR for `try_identity` after SimplifyArmIdentity fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 - let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10 - let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14 - let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 + let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 + let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let _6: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let _10: u32; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:9:8: 9:9 scope 1 { -- debug y => _2; // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 -+ debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 +- debug y => _2; // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 ++ debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 } scope 2 { -- debug err => _6; // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 -+ debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 +- debug err => _6; // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 ++ debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 scope 3 { scope 7 { - debug t => _9; // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL @@ -29,13 +29,13 @@ scope 8 { - debug v => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15 } } } scope 4 { -- debug val => _10; // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 -+ debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 +- debug val => _10; // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 ++ debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 scope 5 { } } @@ -44,55 +44,55 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10 - StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 - _4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:8:9: 8:10 + StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + _4 = _1; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 _3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 } bb1: { -- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 -- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 -- _2 = _10; // scope 5 at $DIR/simplify_try.rs:7:13: 7:15 -- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 -+ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 -- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:8:8: 8:9 -- _11 = _2; // scope 1 at $DIR/simplify_try.rs:8:8: 8:9 -- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 -- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 -- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:8:9: 8:10 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 - goto -> bb3; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 +- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 +- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 +- _2 = _10; // scope 5 at $DIR/simplify_try.rs:8:13: 8:15 +- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 ++ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 + StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 +- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:9:8: 9:9 +- _11 = _2; // scope 1 at $DIR/simplify_try.rs:9:8: 9:9 +- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 +- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 +- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:9:9: 9:10 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 + goto -> bb3; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 } bb2: { -- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 -- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 -- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 -- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 -- _9 = _6; // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 +- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 +- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 +- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 +- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 +- _9 = _6; // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 - _8 = move _9; // scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 +- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 - StorageLive(_12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - _12 = move _8; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - ((_0 as Err).0: i32) = move _12; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_0) = 1; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 -- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 +- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 +- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + _0 = move _3; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 - goto -> bb3; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 + goto -> bb3; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 } bb3: { - return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 + return; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir index 9428d305c8731..0ae89b855ba28 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir @@ -1,35 +1,35 @@ // MIR for `try_identity` after SimplifyBranchSame fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 - let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10 - let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14 - let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 - let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 - let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 + let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 + let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let _6: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + let _10: u32; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 + let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:9:8: 9:9 scope 1 { - debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 } scope 2 { - debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 + debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 scope 3 { scope 7 { debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } scope 8 { debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15 } } } scope 4 { - debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 + debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 scope 5 { } } @@ -38,24 +38,24 @@ fn try_identity(_1: std::result::Result) -> std::result::Result bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + goto -> bb1; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 } bb1: { - _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 - goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 + _0 = move _3; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 + StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 + goto -> bb2; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 } bb2: { - return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 + return; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir index a25472f6a5e05..508f2705d0701 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir @@ -1,13 +1,13 @@ // MIR for `try_identity` after SimplifyLocals fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 scope 1 { - debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 } scope 2 { - debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 + debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 scope 3 { scope 7 { debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL @@ -18,7 +18,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 + debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 scope 5 { } } @@ -27,7 +27,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result Date: Sat, 19 Sep 2020 09:58:13 -0400 Subject: [PATCH 2/2] Remove unnecessary -Zunsound-mir-opts uses in tests --- src/test/mir-opt/inline/inline-any-operand.rs | 2 +- .../mir-opt/inline/inline-trait-method_2.rs | 2 +- .../inline_any_operand.bar.Inline.after.mir | 28 ++- ...line_trait_method_2.test2.Inline.after.mir | 6 +- src/test/mir-opt/issue-73223.rs | 2 - .../issue_73223.main.PreCodegen.32bit.diff | 176 +++++++++--------- .../issue_73223.main.PreCodegen.64bit.diff | 176 +++++++++--------- ..._73223.main.SimplifyArmIdentity.32bit.diff | 76 ++++---- ..._73223.main.SimplifyArmIdentity.64bit.diff | 76 ++++---- src/test/mir-opt/nrvo-simple.rs | 2 +- ...ocals-removes-unused-discriminant-reads.rs | 2 - ...minant_reads.map.SimplifyLocals.32bit.diff | 43 +++-- ...minant_reads.map.SimplifyLocals.64bit.diff | 43 +++-- src/test/mir-opt/simplify_try.rs | 1 - ...y.try_identity.DestinationPropagation.diff | 70 +++---- ..._try.try_identity.SimplifyArmIdentity.diff | 102 +++++----- ....try_identity.SimplifyBranchSame.after.mir | 56 +++--- ..._try.try_identity.SimplifyLocals.after.mir | 14 +- 18 files changed, 459 insertions(+), 418 deletions(-) diff --git a/src/test/mir-opt/inline/inline-any-operand.rs b/src/test/mir-opt/inline/inline-any-operand.rs index feac14eccd85f..fb0de020f73a2 100644 --- a/src/test/mir-opt/inline/inline-any-operand.rs +++ b/src/test/mir-opt/inline/inline-any-operand.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats -Zunsound-mir-opts +// compile-flags: -Z span_free_formats // Tests that MIR inliner works for any operand diff --git a/src/test/mir-opt/inline/inline-trait-method_2.rs b/src/test/mir-opt/inline/inline-trait-method_2.rs index 9626ba123aadb..6e5de8315a1cb 100644 --- a/src/test/mir-opt/inline/inline-trait-method_2.rs +++ b/src/test/mir-opt/inline/inline-trait-method_2.rs @@ -1,4 +1,4 @@ -// compile-flags: -Z span_free_formats -Z mir-opt-level=3 -Zunsound-mir-opts +// compile-flags: -Z span_free_formats -Z mir-opt-level=3 // EMIT_MIR inline_trait_method_2.test2.Inline.after.mir fn test2(x: &dyn X) -> bool { diff --git a/src/test/mir-opt/inline/inline_any_operand.bar.Inline.after.mir b/src/test/mir-opt/inline/inline_any_operand.bar.Inline.after.mir index 756f31315f18a..4d623297f8d68 100644 --- a/src/test/mir-opt/inline/inline_any_operand.bar.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_any_operand.bar.Inline.after.mir @@ -4,13 +4,15 @@ fn bar() -> bool { let mut _0: bool; // return place in scope 0 at $DIR/inline-any-operand.rs:10:13: 10:17 let _1: fn(i32, i32) -> bool {foo}; // in scope 0 at $DIR/inline-any-operand.rs:11:9: 11:10 let mut _2: fn(i32, i32) -> bool {foo}; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:6 - let mut _3: i32; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:13 - let mut _4: i32; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:13 + let mut _5: i32; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:13 + let mut _6: i32; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:13 scope 1 { debug f => _1; // in scope 1 at $DIR/inline-any-operand.rs:11:9: 11:10 scope 2 { - debug x => _3; // in scope 2 at $DIR/inline-any-operand.rs:16:8: 16:9 - debug y => _4; // in scope 2 at $DIR/inline-any-operand.rs:16:16: 16:17 + debug x => _5; // in scope 2 at $DIR/inline-any-operand.rs:16:8: 16:9 + debug y => _6; // in scope 2 at $DIR/inline-any-operand.rs:16:16: 16:17 + let mut _3: i32; // in scope 2 at $DIR/inline-any-operand.rs:12:5: 12:13 + let mut _4: i32; // in scope 2 at $DIR/inline-any-operand.rs:12:5: 12:13 } } @@ -22,13 +24,19 @@ fn bar() -> bool { // + literal: Const { ty: fn(i32, i32) -> bool {foo}, val: Value(Scalar()) } StorageLive(_2); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:6 _2 = _1; // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:6 - StorageLive(_3); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 - _3 = const 1_i32; // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 - StorageLive(_4); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 - _4 = const -1_i32; // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + StorageLive(_5); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + _5 = const 1_i32; // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + StorageLive(_6); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + _6 = const -1_i32; // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + StorageLive(_3); // scope 2 at $DIR/inline-any-operand.rs:17:5: 17:6 + _3 = _5; // scope 2 at $DIR/inline-any-operand.rs:17:5: 17:6 + StorageLive(_4); // scope 2 at $DIR/inline-any-operand.rs:17:10: 17:11 + _4 = _6; // scope 2 at $DIR/inline-any-operand.rs:17:10: 17:11 _0 = Eq(move _3, move _4); // scope 2 at $DIR/inline-any-operand.rs:17:5: 17:11 - StorageDead(_4); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 - StorageDead(_3); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + StorageDead(_4); // scope 2 at $DIR/inline-any-operand.rs:17:10: 17:11 + StorageDead(_3); // scope 2 at $DIR/inline-any-operand.rs:17:10: 17:11 + StorageDead(_6); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 + StorageDead(_5); // scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13 StorageDead(_2); // scope 1 at $DIR/inline-any-operand.rs:12:12: 12:13 StorageDead(_1); // scope 0 at $DIR/inline-any-operand.rs:13:1: 13:2 return; // scope 0 at $DIR/inline-any-operand.rs:13:2: 13:2 diff --git a/src/test/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir b/src/test/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir index 00e3ef06a49e6..09546205962a4 100644 --- a/src/test/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_trait_method_2.test2.Inline.after.mir @@ -7,6 +7,7 @@ fn test2(_1: &dyn X) -> bool { let mut _3: &dyn X; // in scope 0 at $DIR/inline-trait-method_2.rs:5:10: 5:11 scope 1 { debug x => _2; // in scope 1 at $DIR/inline-trait-method_2.rs:9:9: 9:10 + let mut _4: &dyn X; // in scope 1 at $DIR/inline-trait-method_2.rs:5:5: 5:12 } bb0: { @@ -15,13 +16,16 @@ fn test2(_1: &dyn X) -> bool { _3 = &(*_1); // scope 0 at $DIR/inline-trait-method_2.rs:5:10: 5:11 _2 = move _3 as &dyn X (Pointer(Unsize)); // scope 0 at $DIR/inline-trait-method_2.rs:5:10: 5:11 StorageDead(_3); // scope 0 at $DIR/inline-trait-method_2.rs:5:10: 5:11 - _0 = ::y(move _2) -> bb1; // scope 1 at $DIR/inline-trait-method_2.rs:10:5: 10:10 + StorageLive(_4); // scope 1 at $DIR/inline-trait-method_2.rs:10:5: 10:6 + _4 = _2; // scope 1 at $DIR/inline-trait-method_2.rs:10:5: 10:6 + _0 = ::y(move _4) -> bb1; // scope 1 at $DIR/inline-trait-method_2.rs:10:5: 10:10 // mir::Constant // + span: $DIR/inline-trait-method_2.rs:10:7: 10:8 // + literal: Const { ty: for<'r> fn(&'r dyn X) -> bool {::y}, val: Value(Scalar()) } } bb1: { + StorageDead(_4); // scope 1 at $DIR/inline-trait-method_2.rs:10:9: 10:10 StorageDead(_2); // scope 0 at $DIR/inline-trait-method_2.rs:5:11: 5:12 return; // scope 0 at $DIR/inline-trait-method_2.rs:6:2: 6:2 } diff --git a/src/test/mir-opt/issue-73223.rs b/src/test/mir-opt/issue-73223.rs index 5372b6fe024d2..703b876123133 100644 --- a/src/test/mir-opt/issue-73223.rs +++ b/src/test/mir-opt/issue-73223.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zunsound-mir-opts - fn main() { let split = match Some(1) { Some(v) => v, 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 72582ed716cb0..35e4d4321b783 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff @@ -2,60 +2,62 @@ + // MIR for `main` after PreCodegen fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 - let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 + 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 mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _5: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: bool; // 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: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _9: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _10: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _11: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _12: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _13: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _14: &&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: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _9: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _10: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _11: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _13: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _14: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _16: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _18: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _19: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 - let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 + let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { - debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 + debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 scope 4 { - debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug left_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _17; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg0 => _22; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _25; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 6 { - debug x => _20; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _19; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _18: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _19: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _22; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _21; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _20: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _21: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _22: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL } scope 8 { - debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _22; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _21: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _22: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _23: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _25; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _24; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _23: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _24: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _25: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL } } scope 10 { - debug pieces => (_9.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug args => _25; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _24: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _25: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + debug pieces => (_10.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug args => _27; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _26: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _27: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL } } } } scope 2 { - debug v => _1; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 + debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 } scope 7 { } @@ -63,108 +65,110 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 - ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 - discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 + ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 (_4.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_4.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _5 = const main::promoted[1]; // 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[0]), const_param_did: None }, [], Some(promoted[1])) // 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[0]), const_param_did: None }, [], Some(promoted[1])) } - _13 = (_4.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = (_4.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_4.1: &i32) = move _5; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = (_4.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = (_4.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _6 = Eq(move _7, const 1_i32); // 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 + _8 = (*_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = Eq(move _8, const 1_i32); // 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 + _6 = Not(move _7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _5 = Not(move _6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(_5) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(_6) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageDead(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 - return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 + StorageDead(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 + return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } bb2: { - (_9.0: &[&str]) = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) } - StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - (_12.0: &&i32) = &_13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _14 = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_12.1: &&i32) = move _14; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _20 = (_12.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = (_12.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_10.0: &[&str]) = move _11 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_14.0: &&i32) = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = &_17; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_14.1: &&i32) = move _16; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _22 = (_14.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = (_14.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _18 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _19) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_20); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _20 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _21) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb3: { - (_16.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _20) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_18.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _22) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb4: { - (_16.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _18; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _22 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_18.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _20; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_20); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _24 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _21 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _22) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_23); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _23 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _24) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb5: { - (_17.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_19.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb6: { - (_17.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _21; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _11 = [move _16, move _17]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _10 = &_11; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _25 = move _10 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - discriminant(_24) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_9.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _24; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_9.2: &[std::fmt::ArgumentV1]) = move _25; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _8 = &_9; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic_fmt(move _8); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_19.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _23; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_23); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _13 = [move _18, move _19]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _27 = move _12 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_26); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + discriminant(_26) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_10.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _26; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_10.2: &[std::fmt::ArgumentV1]) = move _27; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_26); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _9 = &_10; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + begin_panic_fmt(move _9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/std/src/macros.rs:LL:COL // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff index 72582ed716cb0..35e4d4321b783 100644 --- a/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff @@ -2,60 +2,62 @@ + // MIR for `main` after PreCodegen fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 - let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 + let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 + 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 mut _4: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _5: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _5: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _6: bool; // 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: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _9: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _10: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _11: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _12: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _13: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _14: &&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: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _9: &std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _10: std::fmt::Arguments; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _11: &[&str; 3]; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _12: &[std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _13: [std::fmt::ArgumentV1; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _14: (&&i32, &&i32); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL let _15: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _17: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _16: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let _17: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _18: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _19: std::fmt::ArgumentV1; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 - let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 + let _3: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { - debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 + debug _prev => _3; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 scope 4 { - debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug left_val => _15; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug right_val => _17; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 5 { - debug arg0 => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug arg1 => _23; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg0 => _22; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + debug arg1 => _25; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 6 { - debug x => _20; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _19; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _18: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _19: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _22; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _21; // in scope 6 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _20: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _21: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _22: &&i32; // in scope 6 at $SRC_DIR/std/src/macros.rs:LL:COL } scope 8 { - debug x => _23; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug f => _22; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _21: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _22: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _23: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + debug x => _25; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug f => _24; // in scope 8 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _23: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _24: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _25: &&i32; // in scope 8 at $SRC_DIR/std/src/macros.rs:LL:COL } } scope 10 { - debug pieces => (_9.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - debug args => _25; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - let mut _24: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _25: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + debug pieces => (_10.0: &[&str]); // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + debug args => _27; // in scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + let mut _26: std::option::Option<&[std::fmt::rt::v1::Argument]>; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _27: &[std::fmt::ArgumentV1]; // in scope 10 at $SRC_DIR/std/src/macros.rs:LL:COL } } } } scope 2 { - debug v => _1; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 + debug v => _1; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 } scope 7 { } @@ -63,108 +65,110 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 - ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 - discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + _1 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 + ((_3 as Some).0: i32) = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + discriminant(_3) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 (_4.0: &i32) = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_4.1: &i32) = const main::promoted[1]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _5 = const main::promoted[1]; // 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[0]), const_param_did: None }, [], Some(promoted[1])) // 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[0]), const_param_did: None }, [], Some(promoted[1])) } - _13 = (_4.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = (_4.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_4.1: &i32) = move _5; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _15 = (_4.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _17 = (_4.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _7 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _6 = Eq(move _7, const 1_i32); // 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 + _8 = (*_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = Eq(move _8, const 1_i32); // 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 + _6 = Not(move _7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_7); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _5 = Not(move _6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(_5) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + switchInt(_6) -> [false: bb1, otherwise: bb2]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb1: { - StorageDead(_5); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 - return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 + StorageDead(_6); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 + return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } bb2: { - (_9.0: &[&str]) = const main::promoted[0] as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _11 = const main::promoted[0]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const // + ty: &[&str; 3] // + val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: &[&str; 3], val: Unevaluated(WithOptConstParam { did: DefId(0:3 ~ issue_73223[317d]::main[0]), const_param_did: None }, [], Some(promoted[0])) } - StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - (_12.0: &&i32) = &_13; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_14); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _14 = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_12.1: &&i32) = move _14; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _20 = (_12.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = (_12.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _19 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_10.0: &[&str]) = move _11 as &[&str] (Pointer(Unsize)); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_14.0: &&i32) = &_15; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + StorageLive(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _16 = &_17; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_14.1: &&i32) = move _16; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageDead(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _22 = (_14.0: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _25 = (_14.1: &&i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _21 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _18 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _19) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_20); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _20 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _21) -> bb3; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb3: { - (_16.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _20) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_18.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _22) -> bb4; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb4: { - (_16.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _18; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_18); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _22 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + (_18.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _20; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_20); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _24 = <&i32 as Debug>::fmt as for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> (Pointer(ReifyFnPointer)); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL // + literal: Const { ty: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {<&i32 as std::fmt::Debug>::fmt}, val: Value(Scalar()) } - StorageLive(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _21 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _22) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageLive(_23); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _23 = transmute:: fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _24) -> bb5; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute:: fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar()) } } bb5: { - (_17.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _23) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_19.0: &core::fmt::Opaque) = transmute::<&&i32, &core::fmt::Opaque>(move _25) -> bb6; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar()) } } bb6: { - (_17.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _21; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_21); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _11 = [move _16, move _17]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL - _10 = &_11; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _25 = move _10 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - discriminant(_24) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_9.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _24; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - (_9.2: &[std::fmt::ArgumentV1]) = move _25; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - StorageDead(_24); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL - _8 = &_9; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - begin_panic_fmt(move _8); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + (_19.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _23; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_23); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _13 = [move _18, move _19]; // scope 5 at $SRC_DIR/std/src/macros.rs:LL:COL + _12 = &_13; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _27 = move _12 as &[std::fmt::ArgumentV1] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + StorageLive(_26); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + discriminant(_26) = 0; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_10.1: std::option::Option<&[std::fmt::rt::v1::Argument]>) = move _26; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + (_10.2: &[std::fmt::ArgumentV1]) = move _27; // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + StorageDead(_26); // scope 10 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL + _9 = &_10; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + begin_panic_fmt(move _9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/std/src/macros.rs:LL:COL // + literal: Const { ty: for<'r, 's> fn(&'r std::fmt::Arguments<'s>) -> ! {std::rt::begin_panic_fmt}, val: Value(Scalar()) } diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff index d41d121430106..302612f5a0a28 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff @@ -2,18 +2,18 @@ + // MIR for `main` after SimplifyArmIdentity fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 - let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - let mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:5:9: 5:16 - let _4: i32; // in scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:6:17: 6:23 - let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:9:22: 9:27 + let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 + 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 mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:3:9: 3:16 + let _4: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:4:17: 4:23 + let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 let _8: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: &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 _12: i32; // in scope 0 at $DIR/issue-73223.rs:10:23: 10:24 + let _12: i32; // in scope 0 at $DIR/issue-73223.rs:8:23: 8:24 let mut _15: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _16: bool; // 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 @@ -42,10 +42,10 @@ let mut _42: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _43: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 - let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 + let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { - debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 + debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _45: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -86,7 +86,7 @@ } } scope 2 { - debug v => _4; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 + debug v => _4; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 } scope 7 { } @@ -94,33 +94,33 @@ } bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:4:9: 4:14 - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 - goto -> bb2; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 + StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:9: 2:14 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 + goto -> bb2; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 } bb1: { - _0 = const (); // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 } bb2: { - StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - _1 = _4; // scope 2 at $DIR/issue-73223.rs:5:20: 5:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:5:20: 5:21 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 - StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:9:9: 9:14 - StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 - _7 = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 - ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 - discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 - StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:9:27: 9:28 + StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + _1 = _4; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 + StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 + StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + _7 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 + discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 + StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 StorageLive(_8); // 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 StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -157,7 +157,7 @@ } bb3: { - return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 + return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } bb4: { @@ -167,10 +167,10 @@ StorageDead(_13); // 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(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 - StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:11:1: 11:2 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 + StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } bb5: { diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff index d41d121430106..302612f5a0a28 100644 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff @@ -2,18 +2,18 @@ + // MIR for `main` after SimplifyArmIdentity fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:3:11: 3:11 - let _1: i32; // in scope 0 at $DIR/issue-73223.rs:4:9: 4:14 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - let mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:5:9: 5:16 - let _4: i32; // in scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:6:17: 6:23 - let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:9:22: 9:27 + let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:1:11: 1:11 + 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 mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:3:9: 3:16 + let _4: i32; // in scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:4:17: 4:23 + let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:7:22: 7:27 let _8: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _9: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _10: &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 _12: i32; // in scope 0 at $DIR/issue-73223.rs:10:23: 10:24 + let _12: i32; // in scope 0 at $DIR/issue-73223.rs:8:23: 8:24 let mut _15: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _16: bool; // 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 @@ -42,10 +42,10 @@ let mut _42: &&i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _43: for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:4:9: 4:14 - let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:9:9: 9:14 + debug split => _1; // in scope 1 at $DIR/issue-73223.rs:2:9: 2:14 + let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:7:9: 7:14 scope 3 { - debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:9:9: 9:14 + debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:7:9: 7:14 let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL let mut _45: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -86,7 +86,7 @@ } } scope 2 { - debug v => _4; // in scope 2 at $DIR/issue-73223.rs:5:14: 5:15 + debug v => _4; // in scope 2 at $DIR/issue-73223.rs:3:14: 3:15 } scope 7 { } @@ -94,33 +94,33 @@ } bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:4:9: 4:14 - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:4:23: 4:30 - _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 - goto -> bb2; // scope 0 at $DIR/issue-73223.rs:5:9: 5:16 + StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:2:9: 2:14 + StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:2:23: 2:30 + _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 + goto -> bb2; // scope 0 at $DIR/issue-73223.rs:3:9: 3:16 } bb1: { - _0 = const (); // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:6:17: 6:23 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 } bb2: { - StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:5:14: 5:15 - _1 = _4; // scope 2 at $DIR/issue-73223.rs:5:20: 5:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:5:20: 5:21 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:7:6: 7:7 - StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:9:9: 9:14 - StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 - _7 = _1; // scope 1 at $DIR/issue-73223.rs:9:22: 9:27 - ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 - discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:9:17: 9:28 - StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:9:27: 9:28 + StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 + _1 = _4; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 + StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 + StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 + StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 + StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + _7 = _1; // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 + ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 + discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:7:17: 7:28 + StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:7:27: 7:28 StorageLive(_8); // 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 StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL @@ -157,7 +157,7 @@ } bb3: { - return; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 + return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } bb4: { @@ -167,10 +167,10 @@ StorageDead(_13); // 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(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _0 = const (); // scope 0 at $DIR/issue-73223.rs:3:11: 11:2 - StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:11:1: 11:2 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:11:1: 11:2 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:11:2: 11:2 + _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 + StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 + StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 + goto -> bb3; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 } bb5: { diff --git a/src/test/mir-opt/nrvo-simple.rs b/src/test/mir-opt/nrvo-simple.rs index 22b18b107701e..ab46d7b94c72c 100644 --- a/src/test/mir-opt/nrvo-simple.rs +++ b/src/test/mir-opt/nrvo-simple.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zmir-opt-level=1 -Zunsound-mir-opts +// compile-flags: -Zmir-opt-level=1 // EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { diff --git a/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs b/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs index 84f57deccf7e0..cf8940ec33096 100644 --- a/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs +++ b/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs @@ -1,5 +1,3 @@ -// compile-flags: -Zunsound-mir-opts - fn map(x: Option>) -> Option> { match x { None => None, diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff index 760fb747f7229..165612a83c3c7 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff @@ -2,25 +2,38 @@ + // MIR for `map` after SimplifyLocals fn map(_1: Option>) -> Option> { - debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:8: 3:9 - let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:31: 3:46 -- let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 -- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 -- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:25: 6:26 -- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 -- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 -- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 + debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:8: 1:9 + let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:31: 1:46 + let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 +- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 +- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:25: 4:26 +- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 +- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 +- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 scope 1 { - debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 + debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 } bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 -- _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 - _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:20: 6:27 -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 - return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:2: 8:2 +- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 +- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 + _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 + switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 + } + + bb1: { + _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:20: 4:27 + goto -> bb3; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:2:5: 5:6 + } + + bb2: { + discriminant(_0) = 0; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 + goto -> bb3; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:2:5: 5:6 + } + + bb3: { +- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 + return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff index 760fb747f7229..165612a83c3c7 100644 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff +++ b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff @@ -2,25 +2,38 @@ + // MIR for `map` after SimplifyLocals fn map(_1: Option>) -> Option> { - debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:8: 3:9 - let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:31: 3:46 -- let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 -- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 -- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:25: 6:26 -- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 -- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 -- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 + debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:8: 1:9 + let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:1:31: 1:46 + let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 +- let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 +- let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:25: 4:26 +- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 +- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 +- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 scope 1 { - debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:14: 6:15 + debug x => ((_0 as Some).0: std::boxed::Box<()>); // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:14: 4:15 } bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 -- _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:5:9: 5:13 - _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:20: 6:27 -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:1: 8:2 - return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:8:2: 8:2 +- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 +- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 + _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 + switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:9: 3:13 + } + + bb1: { + _0 = move _1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:4:20: 4:27 + goto -> bb3; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:2:5: 5:6 + } + + bb2: { + discriminant(_0) = 0; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:3:17: 3:21 + goto -> bb3; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:2:5: 5:6 + } + + bb3: { +- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:1: 6:2 + return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:6:2: 6:2 } } diff --git a/src/test/mir-opt/simplify_try.rs b/src/test/mir-opt/simplify_try.rs index eb307de20744a..fca80bee89679 100644 --- a/src/test/mir-opt/simplify_try.rs +++ b/src/test/mir-opt/simplify_try.rs @@ -1,4 +1,3 @@ -// compile-flags: -Zunsound-mir-opts // EMIT_MIR simplify_try.try_identity.SimplifyArmIdentity.diff // EMIT_MIR simplify_try.try_identity.SimplifyBranchSame.after.mir // EMIT_MIR simplify_try.try_identity.SimplifyLocals.after.mir diff --git a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff index b3a2b6fbf76b2..187a3cfbb896d 100644 --- a/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff +++ b/src/test/mir-opt/simplify_try.try_identity.DestinationPropagation.diff @@ -2,35 +2,35 @@ + // MIR for `try_identity` after DestinationPropagation fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 - let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 - let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:14 - let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let _6: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let _10: u32; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:9:8: 9:9 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 + let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10 + let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9 scope 1 { - debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 } scope 2 { - debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 + debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 scope 3 { scope 7 { debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } scope 8 { debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15 } } } scope 4 { - debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 + debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 scope 5 { } } @@ -40,33 +40,33 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:8:9: 8:10 -- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 -- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 -- _4 = _1; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10 +- StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 +- StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 +- _4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 - _3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 -- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 -+ nop; // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 -+ nop; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 -+ _0 = _1; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 +- StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 +- _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 ++ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 ++ nop; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 ++ _0 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + nop; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -+ nop; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 -+ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - goto -> bb1; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 ++ nop; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 ++ _5 = discriminant(_0); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + goto -> bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 } bb1: { -- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 -- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 -+ nop; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 -+ nop; // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 - goto -> bb2; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 +- _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 +- StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 ++ nop; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 ++ nop; // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 + goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 } bb2: { - return; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 + return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff index 14a4318c1bc6f..0c687684c508e 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyArmIdentity.diff @@ -2,25 +2,25 @@ + // MIR for `try_identity` after SimplifyArmIdentity fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 - let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 - let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:14 - let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let _6: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let _10: u32; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:9:8: 9:9 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 + let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10 + let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9 scope 1 { -- debug y => _2; // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 -+ debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 +- debug y => _2; // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 ++ debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 } scope 2 { -- debug err => _6; // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 -+ debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 +- debug err => _6; // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 ++ debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 scope 3 { scope 7 { - debug t => _9; // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL @@ -29,13 +29,13 @@ scope 8 { - debug v => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15 } } } scope 4 { -- debug val => _10; // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 -+ debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 +- debug val => _10; // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 ++ debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 scope 5 { } } @@ -44,55 +44,55 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:8:9: 8:10 - StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 - _4 = _1; // scope 0 at $DIR/simplify_try.rs:8:13: 8:14 + StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:7:9: 7:10 + StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + _4 = _1; // scope 0 at $DIR/simplify_try.rs:7:13: 7:14 _3 = move _4; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 } bb1: { -- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 -- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:8:13: 8:15 -- _2 = _10; // scope 5 at $DIR/simplify_try.rs:8:13: 8:15 -- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 -+ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 -- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:9:8: 9:9 -- _11 = _2; // scope 1 at $DIR/simplify_try.rs:9:8: 9:9 -- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 -- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 -- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:9:9: 9:10 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 - goto -> bb3; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 +- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 +- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:7:13: 7:15 +- _2 = _10; // scope 5 at $DIR/simplify_try.rs:7:13: 7:15 +- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 ++ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 + StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 +- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:8:8: 8:9 +- _11 = _2; // scope 1 at $DIR/simplify_try.rs:8:8: 8:9 +- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 +- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 +- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:8:9: 8:10 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 + goto -> bb3; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 } bb2: { -- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 -- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 -- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 -- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 -- _9 = _6; // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 +- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 +- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 +- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 +- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 +- _9 = _6; // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 - _8 = move _9; // scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 +- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 - StorageLive(_12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - _12 = move _8; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - ((_0 as Err).0: i32) = move _12; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_0) = 1; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:8:14: 8:15 -- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 +- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:7:14: 7:15 +- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + _0 = move _3; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 - goto -> bb3; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 + goto -> bb3; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 } bb3: { - return; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 + return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir index 0ae89b855ba28..9428d305c8731 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyBranchSame.after.mir @@ -1,35 +1,35 @@ // MIR for `try_identity` after SimplifyBranchSame fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 - let _2: u32; // in scope 0 at $DIR/simplify_try.rs:8:9: 8:10 - let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:14 - let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let _6: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:8:14: 8:15 - let _10: u32; // in scope 0 at $DIR/simplify_try.rs:8:13: 8:15 - let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:9:8: 9:9 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 + let _2: u32; // in scope 0 at $DIR/simplify_try.rs:7:9: 7:10 + let mut _3: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + let mut _4: std::result::Result; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:14 + let mut _5: isize; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let _6: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _7: !; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _8: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let mut _9: i32; // in scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + let _10: u32; // in scope 0 at $DIR/simplify_try.rs:7:13: 7:15 + let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:8:8: 8:9 scope 1 { - debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 } scope 2 { - debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 + debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 scope 3 { scope 7 { debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } scope 8 { debug v => ((_0 as Err).0: i32); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:8:14: 8:15 + let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:7:14: 7:15 } } } scope 4 { - debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 + debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 scope 5 { } } @@ -38,24 +38,24 @@ fn try_identity(_1: std::result::Result) -> std::result::Result bb1; // scope 0 at $DIR/simplify_try.rs:8:14: 8:15 + StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + _5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 + goto -> bb1; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 } bb1: { - _0 = move _3; // scope 1 at $DIR/simplify_try.rs:9:5: 9:10 - StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:8:15: 8:16 - StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:10:1: 10:2 - goto -> bb2; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 + _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 + StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 + StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 + goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 } bb2: { - return; // scope 0 at $DIR/simplify_try.rs:10:2: 10:2 + return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 } } diff --git a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir index 508f2705d0701..a25472f6a5e05 100644 --- a/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir +++ b/src/test/mir-opt/simplify_try.try_identity.SimplifyLocals.after.mir @@ -1,13 +1,13 @@ // MIR for `try_identity` after SimplifyLocals fn try_identity(_1: std::result::Result) -> std::result::Result { - debug x => _1; // in scope 0 at $DIR/simplify_try.rs:7:17: 7:18 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:7:41: 7:57 + debug x => _1; // in scope 0 at $DIR/simplify_try.rs:6:17: 6:18 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/simplify_try.rs:6:41: 6:57 scope 1 { - debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:8:9: 8:10 + debug y => ((_0 as Ok).0: u32); // in scope 1 at $DIR/simplify_try.rs:7:9: 7:10 } scope 2 { - debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:8:14: 8:15 + debug err => ((_0 as Err).0: i32); // in scope 2 at $DIR/simplify_try.rs:7:14: 7:15 scope 3 { scope 7 { debug t => ((_0 as Err).0: i32); // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL @@ -18,7 +18,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:8:13: 8:15 + debug val => ((_0 as Ok).0: u32); // in scope 4 at $DIR/simplify_try.rs:7:13: 7:15 scope 5 { } } @@ -27,7 +27,7 @@ fn try_identity(_1: std::result::Result) -> std::result::Result