From a03c9728168b5adb172c1f43951a7613d7f2a50a Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 21 May 2023 10:33:03 +0000 Subject: [PATCH] Enable GVN by default. --- compiler/rustc_mir_transform/src/gvn.rs | 2 +- compiler/rustc_mir_transform/src/lib.rs | 2 +- .../issues/issue-105386-ub-in-debuginfo.rs | 2 - tests/coverage/async2.cov-map | 14 +- tests/coverage/partial_eq.cov-map | 8 +- ...onential_common.ConstProp.panic-abort.diff | 65 ++-- ...nential_common.ConstProp.panic-unwind.diff | 65 ++-- ...67_inline_as_ref_as_mut.b.Inline.after.mir | 2 +- ...67_inline_as_ref_as_mut.d.Inline.after.mir | 2 +- ...ue_101973.inner.ConstProp.panic-abort.diff | 56 ++-- ...e_101973.inner.ConstProp.panic-unwind.diff | 56 ++-- ...ecked_ops.checked_shl.PreCodegen.after.mir | 6 +- ...d_constant.main.GVN.32bit.panic-abort.diff | 6 +- ..._constant.main.GVN.32bit.panic-unwind.diff | 6 +- ...d_constant.main.GVN.64bit.panic-abort.diff | 6 +- ..._constant.main.GVN.64bit.panic-unwind.diff | 6 +- .../loops.int_range.PreCodegen.after.mir | 6 +- tests/mir-opt/pre-codegen/loops.rs | 1 + ...able.main.ConstProp.32bit.panic-abort.diff | 47 +-- ...ble.main.ConstProp.32bit.panic-unwind.diff | 47 +-- ...able.main.ConstProp.64bit.panic-abort.diff | 47 +-- ...ble.main.ConstProp.64bit.panic-unwind.diff | 47 +-- ...ward_loop.PreCodegen.after.panic-abort.mir | 6 +- ...ard_loop.PreCodegen.after.panic-unwind.mir | 6 +- ...iter_next.PreCodegen.after.panic-abort.mir | 6 +- ...ter_next.PreCodegen.after.panic-unwind.mir | 6 +- ...mple_option_map.ezmap.PreCodegen.after.mir | 6 +- ...variant_a-{closure#0}.PreCodegen.after.mir | 302 ++++++++---------- ...variant_b-{closure#0}.PreCodegen.after.mir | 56 ++-- ...mut_usize.PreCodegen.after.panic-abort.mir | 2 - ...ut_usize.PreCodegen.after.panic-unwind.mir | 2 - ...ange_loop.PreCodegen.after.panic-abort.mir | 6 +- ...nge_loop.PreCodegen.after.panic-unwind.mir | 6 +- ...lify_match.main.ConstProp.panic-abort.diff | 10 +- ...ify_match.main.ConstProp.panic-unwind.diff | 10 +- 35 files changed, 389 insertions(+), 534 deletions(-) diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 3b8adf7e86b..13e5ffea390 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -109,7 +109,7 @@ pub struct GVN; impl<'tcx> MirPass<'tcx> for GVN { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() >= 4 + sess.mir_opt_level() >= 2 } #[instrument(level = "trace", skip(self, tcx, body))] diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 98d4d96d0c7..10ebf469d85 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -588,9 +588,9 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { // destroy the SSA property. It should still happen before const-propagation, so the // latter pass will leverage the created opportunities. &separate_const_switch::SeparateConstSwitch, - &const_prop::ConstProp, &gvn::GVN, &simplify::SimplifyLocals::AfterGVN, + &const_prop::ConstProp, &dataflow_const_prop::DataflowConstProp, &const_debuginfo::ConstDebugInfo, &o1(simplify_branches::SimplifyConstCondition::AfterConstProp), diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index 54c50f840c5..a9538da1975 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -19,5 +19,3 @@ pub fn outer_function(x: S, y: S) -> usize { // CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"{closure@{{.*.rs}}:9:23: 9:25}", ptr [[spill]] // CHECK-NOT: [[load:%.*]] = load ptr, ptr // CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]]) -// CHECK: [[inner:%.*]] = getelementptr inbounds %"{{.*}}", ptr [[spill]] -// CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[inner]], ptr {{align .*}} %x diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map index b120e28c464..28f319bfb80 100644 --- a/tests/coverage/async2.cov-map +++ b/tests/coverage/async2.cov-map @@ -7,19 +7,17 @@ Number of file 0 mappings: 1 - Code(Counter(0)) at (prev + 13, 1) to (start + 0, 23) Function name: async2::async_func::{closure#0} -Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0d, 17, 03, 09, 05, 03, 0a, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02] +Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 0d, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 03, 01, 01, 00, 02] Number of files: 1 - file 0 => global file 1 -Number of expressions: 2 -- expression 0 operands: lhs = Counter(0), rhs = Counter(1) -- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) +Number of expressions: 1 +- expression 0 operands: lhs = Counter(1), rhs = Zero Number of file 0 mappings: 4 - Code(Counter(0)) at (prev + 13, 23) to (start + 3, 9) - Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6) -- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7) - = (c0 - c1) -- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2) - = (c1 + (c0 - c1)) +- Code(Zero) at (prev + 2, 6) to (start + 0, 7) +- Code(Expression(0, Add)) at (prev + 1, 1) to (start + 0, 2) + = (c1 + Zero) Function name: async2::async_func_just_println Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 24] diff --git a/tests/coverage/partial_eq.cov-map b/tests/coverage/partial_eq.cov-map index 3549116db7a..3a803e3c18f 100644 --- a/tests/coverage/partial_eq.cov-map +++ b/tests/coverage/partial_eq.cov-map @@ -25,18 +25,18 @@ Number of file 0 mappings: 2 - Code(Zero) at (prev + 0, 32) to (start + 0, 33) Function name: ::partial_cmp -Raw bytes (22): 0x[01, 01, 04, 07, 0b, 05, 09, 0f, 15, 0d, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31] +Raw bytes (22): 0x[01, 01, 04, 07, 0b, 00, 09, 0f, 15, 00, 11, 02, 01, 04, 27, 00, 28, 03, 00, 30, 00, 31] Number of files: 1 - file 0 => global file 1 Number of expressions: 4 - expression 0 operands: lhs = Expression(1, Add), rhs = Expression(2, Add) -- expression 1 operands: lhs = Counter(1), rhs = Counter(2) +- expression 1 operands: lhs = Zero, rhs = Counter(2) - expression 2 operands: lhs = Expression(3, Add), rhs = Counter(5) -- expression 3 operands: lhs = Counter(3), rhs = Counter(4) +- expression 3 operands: lhs = Zero, rhs = Counter(4) Number of file 0 mappings: 2 - Code(Counter(0)) at (prev + 4, 39) to (start + 0, 40) - Code(Expression(0, Add)) at (prev + 0, 48) to (start + 0, 49) - = ((c1 + c2) + ((c3 + c4) + c5)) + = ((Zero + c2) + ((Zero + c4) + c5)) Function name: ::fmt Raw bytes (9): 0x[01, 01, 00, 01, 01, 04, 11, 00, 16] diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff index 298a6084899..9d4bfcffcf0 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-abort.diff @@ -9,17 +9,10 @@ let _4: bool; let mut _6: std::option::Option; let mut _7: isize; - let mut _9: &mut std::fmt::Formatter<'_>; - let mut _10: &T; - let mut _11: core::num::flt2dec::Sign; - let mut _12: u32; - let mut _13: u32; - let mut _14: usize; - let mut _15: bool; - let mut _16: &mut std::fmt::Formatter<'_>; - let mut _17: &T; - let mut _18: core::num::flt2dec::Sign; - let mut _19: bool; + let mut _9: core::num::flt2dec::Sign; + let mut _10: u32; + let mut _11: u32; + let mut _12: core::num::flt2dec::Sign; scope 1 { debug force_sign => _4; let _5: core::num::flt2dec::Sign; @@ -36,32 +29,30 @@ } scope 4 (inlined Formatter::<'_>::sign_plus) { debug self => _1; - let mut _20: u32; - let mut _21: u32; + let mut _13: u32; + let mut _14: u32; } bb0: { StorageLive(_4); - StorageLive(_20); - StorageLive(_21); - _21 = ((*_1).0: u32); - _20 = BitAnd(move _21, const 1_u32); - StorageDead(_21); - _4 = Ne(move _20, const 0_u32); - StorageDead(_20); + StorageLive(_13); + StorageLive(_14); + _14 = ((*_1).0: u32); + _13 = BitAnd(move _14, const 1_u32); + StorageDead(_14); + _4 = Ne(move _13, const 0_u32); + StorageDead(_13); StorageLive(_5); switchInt(_4) -> [0: bb2, otherwise: bb1]; } bb1: { -- _5 = MinusPlus; -+ _5 = const MinusPlus; + _5 = const MinusPlus; goto -> bb3; } bb2: { -- _5 = Minus; -+ _5 = const Minus; + _5 = const Minus; goto -> bb3; } @@ -74,30 +65,30 @@ bb4: { _8 = ((_6 as Some).0: usize); + StorageLive(_9); + _9 = _5; + StorageLive(_10); StorageLive(_11); - _11 = _5; - StorageLive(_12); - StorageLive(_13); - _13 = _8 as u32 (IntToInt); - _12 = Add(move _13, const 1_u32); - StorageDead(_13); - _0 = float_to_exponential_common_exact::(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind unreachable]; + _11 = _8 as u32 (IntToInt); + _10 = Add(move _11, const 1_u32); + StorageDead(_11); + _0 = float_to_exponential_common_exact::(_1, _2, move _9, move _10, _3) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_12); - StorageDead(_11); + StorageDead(_10); + StorageDead(_9); goto -> bb8; } bb6: { - StorageLive(_18); - _18 = _5; - _0 = float_to_exponential_common_shortest::(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable]; + StorageLive(_12); + _12 = _5; + _0 = float_to_exponential_common_shortest::(_1, _2, move _12, _3) -> [return: bb7, unwind unreachable]; } bb7: { - StorageDead(_18); + StorageDead(_12); goto -> bb8; } diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff index 037f4f7cfac..594609fade9 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff @@ -9,17 +9,10 @@ let _4: bool; let mut _6: std::option::Option; let mut _7: isize; - let mut _9: &mut std::fmt::Formatter<'_>; - let mut _10: &T; - let mut _11: core::num::flt2dec::Sign; - let mut _12: u32; - let mut _13: u32; - let mut _14: usize; - let mut _15: bool; - let mut _16: &mut std::fmt::Formatter<'_>; - let mut _17: &T; - let mut _18: core::num::flt2dec::Sign; - let mut _19: bool; + let mut _9: core::num::flt2dec::Sign; + let mut _10: u32; + let mut _11: u32; + let mut _12: core::num::flt2dec::Sign; scope 1 { debug force_sign => _4; let _5: core::num::flt2dec::Sign; @@ -36,32 +29,30 @@ } scope 4 (inlined Formatter::<'_>::sign_plus) { debug self => _1; - let mut _20: u32; - let mut _21: u32; + let mut _13: u32; + let mut _14: u32; } bb0: { StorageLive(_4); - StorageLive(_20); - StorageLive(_21); - _21 = ((*_1).0: u32); - _20 = BitAnd(move _21, const 1_u32); - StorageDead(_21); - _4 = Ne(move _20, const 0_u32); - StorageDead(_20); + StorageLive(_13); + StorageLive(_14); + _14 = ((*_1).0: u32); + _13 = BitAnd(move _14, const 1_u32); + StorageDead(_14); + _4 = Ne(move _13, const 0_u32); + StorageDead(_13); StorageLive(_5); switchInt(_4) -> [0: bb2, otherwise: bb1]; } bb1: { -- _5 = MinusPlus; -+ _5 = const MinusPlus; + _5 = const MinusPlus; goto -> bb3; } bb2: { -- _5 = Minus; -+ _5 = const Minus; + _5 = const Minus; goto -> bb3; } @@ -74,30 +65,30 @@ bb4: { _8 = ((_6 as Some).0: usize); + StorageLive(_9); + _9 = _5; + StorageLive(_10); StorageLive(_11); - _11 = _5; - StorageLive(_12); - StorageLive(_13); - _13 = _8 as u32 (IntToInt); - _12 = Add(move _13, const 1_u32); - StorageDead(_13); - _0 = float_to_exponential_common_exact::(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind continue]; + _11 = _8 as u32 (IntToInt); + _10 = Add(move _11, const 1_u32); + StorageDead(_11); + _0 = float_to_exponential_common_exact::(_1, _2, move _9, move _10, _3) -> [return: bb5, unwind continue]; } bb5: { - StorageDead(_12); - StorageDead(_11); + StorageDead(_10); + StorageDead(_9); goto -> bb8; } bb6: { - StorageLive(_18); - _18 = _5; - _0 = float_to_exponential_common_shortest::(_1, _2, move _18, _3) -> [return: bb7, unwind continue]; + StorageLive(_12); + _12 = _5; + _0 = float_to_exponential_common_shortest::(_1, _2, move _12, _3) -> [return: bb7, unwind continue]; } bb7: { - StorageDead(_18); + StorageDead(_12); goto -> bb8; } diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 62d7e839f5a..408cc5bb341 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -19,7 +19,7 @@ fn b(_1: &mut Box) -> &mut T { _4 = &mut (*_1); StorageLive(_5); StorageLive(_6); - _5 = deref_copy (*_4); + _5 = (*_4); _6 = (((_5.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); _3 = &mut (*_6); StorageDead(_6); diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index bc0aa06a752..4d20f6c4419 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -17,7 +17,7 @@ fn d(_1: &Box) -> &T { _3 = &(*_1); StorageLive(_4); StorageLive(_5); - _4 = deref_copy (*_3); + _4 = (*_3); _5 = (((_4.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); _2 = &(*_5); StorageDead(_5); diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff index 3748d148380..d082e9d31dc 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-abort.diff @@ -10,23 +10,17 @@ let mut _5: u32; let mut _6: u32; let mut _7: u32; - let mut _8: u32; - let mut _9: u32; - let mut _10: u32; - let mut _11: bool; - let mut _12: u32; - let mut _13: bool; scope 1 (inlined imm8) { debug x => _1; - let mut _14: u32; - let mut _15: u32; + let mut _8: u32; + let mut _9: u32; scope 2 { debug out => _4; } } scope 3 (inlined core::num::::rotate_right) { debug self => _4; - debug n => _6; + debug n => _5; } bb0: { @@ -34,44 +28,34 @@ StorageLive(_3); StorageLive(_4); _4 = const 0_u32; - StorageLive(_15); - StorageLive(_14); - _14 = Shr(_1, const 0_i32); - _15 = BitAnd(move _14, const 255_u32); - StorageDead(_14); - _4 = BitOr(const 0_u32, move _15); - StorageDead(_15); + StorageLive(_9); + StorageLive(_8); + _8 = Shr(_1, const 0_i32); + _9 = BitAnd(move _8, const 255_u32); + StorageDead(_8); + _4 = BitOr(const 0_u32, move _9); + StorageDead(_9); + StorageLive(_5); StorageLive(_6); StorageLive(_7); - StorageLive(_8); -- _10 = const 8_i32 as u32 (IntToInt); -- _11 = Lt(move _10, const 32_u32); -- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; -+ _10 = const 8_u32; -+ _11 = const true; -+ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; + assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; } bb1: { - _8 = Shr(_1, const 8_i32); - _7 = BitAnd(move _8, const 15_u32); - StorageDead(_8); -- _12 = const 1_i32 as u32 (IntToInt); -- _13 = Lt(move _12, const 32_u32); -- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable]; -+ _12 = const 1_u32; -+ _13 = const true; -+ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable]; + _7 = Shr(_1, const 8_i32); + _6 = BitAnd(move _7, const 15_u32); + StorageDead(_7); + assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind unreachable]; } bb2: { - _6 = Shl(move _7, const 1_i32); - StorageDead(_7); - _3 = rotate_right::(move _4, move _6) -> [return: bb3, unwind unreachable]; + _5 = Shl(move _6, const 1_i32); + StorageDead(_6); + _3 = rotate_right::(move _4, move _5) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_6); + StorageDead(_5); StorageDead(_4); _2 = move _3 as i32 (IntToInt); StorageDead(_3); diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff index 9dab4233c56..0962a449f73 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff @@ -10,23 +10,17 @@ let mut _5: u32; let mut _6: u32; let mut _7: u32; - let mut _8: u32; - let mut _9: u32; - let mut _10: u32; - let mut _11: bool; - let mut _12: u32; - let mut _13: bool; scope 1 (inlined imm8) { debug x => _1; - let mut _14: u32; - let mut _15: u32; + let mut _8: u32; + let mut _9: u32; scope 2 { debug out => _4; } } scope 3 (inlined core::num::::rotate_right) { debug self => _4; - debug n => _6; + debug n => _5; } bb0: { @@ -34,44 +28,34 @@ StorageLive(_3); StorageLive(_4); _4 = const 0_u32; - StorageLive(_15); - StorageLive(_14); - _14 = Shr(_1, const 0_i32); - _15 = BitAnd(move _14, const 255_u32); - StorageDead(_14); - _4 = BitOr(const 0_u32, move _15); - StorageDead(_15); + StorageLive(_9); + StorageLive(_8); + _8 = Shr(_1, const 0_i32); + _9 = BitAnd(move _8, const 255_u32); + StorageDead(_8); + _4 = BitOr(const 0_u32, move _9); + StorageDead(_9); + StorageLive(_5); StorageLive(_6); StorageLive(_7); - StorageLive(_8); -- _10 = const 8_i32 as u32 (IntToInt); -- _11 = Lt(move _10, const 32_u32); -- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; -+ _10 = const 8_u32; -+ _11 = const true; -+ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; + assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; } bb1: { - _8 = Shr(_1, const 8_i32); - _7 = BitAnd(move _8, const 15_u32); - StorageDead(_8); -- _12 = const 1_i32 as u32 (IntToInt); -- _13 = Lt(move _12, const 32_u32); -- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue]; -+ _12 = const 1_u32; -+ _13 = const true; -+ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue]; + _7 = Shr(_1, const 8_i32); + _6 = BitAnd(move _7, const 15_u32); + StorageDead(_7); + assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue]; } bb2: { - _6 = Shl(move _7, const 1_i32); - StorageDead(_7); - _3 = rotate_right::(move _4, move _6) -> [return: bb3, unwind unreachable]; + _5 = Shl(move _6, const 1_i32); + StorageDead(_6); + _3 = rotate_right::(move _4, move _5) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_6); + StorageDead(_5); StorageDead(_4); _2 = move _3 as i32 (IntToInt); StorageDead(_3); diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 8304cb45b35..9c6c30214aa 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -55,7 +55,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { } bb3: { - _0 = Option::::None; + _0 = const Option::::None; goto -> bb4; } @@ -66,3 +66,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { return; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index d5628dc7a6e..5cb528c0d5f 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -55,8 +55,10 @@ - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff index d28059458ae..1e1585f20ae 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff @@ -40,8 +40,10 @@ - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb2, 1: bb4, otherwise: bb3]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index d139fc73e21..e655af559a1 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -55,8 +55,10 @@ - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff index 63db9553b37..a6658713a02 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff @@ -40,8 +40,10 @@ - _2 = Option::::None; + _2 = const Option::::None; StorageLive(_10); - _10 = const 0_isize; - switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; +- _10 = discriminant(_2); +- switchInt(move _10) -> [0: bb2, 1: bb4, otherwise: bb3]; ++ _10 = const 0_isize; ++ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index 73a3be7f301..42c7eb3c6aa 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -72,7 +72,7 @@ fn int_range(_1: usize, _2: usize) -> () { bb2: { StorageDead(_7); StorageDead(_6); - _11 = Option::::None; + _11 = const Option::::None; goto -> bb5; } @@ -118,3 +118,7 @@ fn int_range(_1: usize, _2: usize) -> () { unreachable; } } + +ALLOC0 (size: 16, align: 8) { + 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ +} diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs index 7f9c26f4fff..9412c3f234e 100644 --- a/tests/mir-opt/pre-codegen/loops.rs +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -1,6 +1,7 @@ // skip-filecheck // compile-flags: -O -Zmir-opt-level=2 -g // needs-unwind +// only-64bit #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff index bddd961c933..8c7ed678fe1 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff @@ -4,60 +4,35 @@ fn main() -> () { let mut _0: (); let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: u32; + let mut _3: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; scope 3 { - debug z => _9; + debug z => _3; } } } bb0: { StorageLive(_1); -- _2 = CheckedAdd(const 2_i32, const 2_i32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_i32; - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; -+ _7 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; - StorageDead(_3); + _2 = const 3_i32; + _3 = const 42_u32; + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff index 297ebd79fad..5ba417a5b0f 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff @@ -4,60 +4,35 @@ fn main() -> () { let mut _0: (); let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: u32; + let mut _3: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; scope 3 { - debug z => _9; + debug z => _3; } } } bb0: { StorageLive(_1); -- _2 = CheckedAdd(const 2_i32, const 2_i32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_i32; - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; -+ _7 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; - StorageDead(_3); + _2 = const 3_i32; + _3 = const 42_u32; + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff index bddd961c933..8c7ed678fe1 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff @@ -4,60 +4,35 @@ fn main() -> () { let mut _0: (); let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: u32; + let mut _3: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; scope 3 { - debug z => _9; + debug z => _3; } } } bb0: { StorageLive(_1); -- _2 = CheckedAdd(const 2_i32, const 2_i32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_i32; - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; -+ _7 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; - StorageDead(_3); + _2 = const 3_i32; + _3 = const 42_u32; + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff index 297ebd79fad..5ba417a5b0f 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff @@ -4,60 +4,35 @@ fn main() -> () { let mut _0: (); let _1: i32; - let mut _2: (i32, bool); - let mut _4: [i32; 6]; - let _5: usize; - let mut _6: usize; - let mut _7: bool; - let mut _9: u32; + let mut _3: u32; scope 1 { debug x => _1; - let _3: i32; + let _2: i32; scope 2 { - debug y => _3; - let _8: u32; + debug y => _2; scope 3 { - debug z => _9; + debug z => _3; } } } bb0: { StorageLive(_1); -- _2 = CheckedAdd(const 2_i32, const 2_i32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; -+ _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { -- _1 = move (_2.0: i32); -+ _1 = const 4_i32; - StorageLive(_3); - StorageLive(_4); - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; - StorageLive(_5); - _5 = const 3_usize; - _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; -+ _7 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; + _1 = const 4_i32; + StorageLive(_2); + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { -- _3 = _4[_5]; -+ _3 = const 3_i32; - StorageDead(_5); - StorageDead(_4); - _9 = const 42_u32; - StorageDead(_3); + _2 = const 3_i32; + _3 = const 42_u32; + StorageDead(_2); StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 04 00 00 00 00 __ __ __ │ .....░░░ } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir index cd734b10fea..e5940bd8201 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -75,7 +75,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb2: { StorageDead(_8); StorageDead(_7); - _12 = Option::::None; + _12 = const Option::::None; goto -> bb5; } @@ -131,3 +131,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { unreachable; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index 3342da545ae..87e7485cb36 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -75,7 +75,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb2: { StorageDead(_8); StorageDead(_7); - _12 = Option::::None; + _12 = const Option::::None; goto -> bb5; } @@ -139,3 +139,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { resume; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir index 6ed3d73b11d..f674f6a3009 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir @@ -46,7 +46,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { bb1: { StorageDead(_3); StorageDead(_2); - _0 = Option::::None; + _0 = const Option::::None; goto -> bb4; } @@ -71,3 +71,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { return; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index a030647deae..a5029dcad3a 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -46,7 +46,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { bb1: { StorageDead(_3); StorageDead(_2); - _0 = Option::::None; + _0 = const Option::::None; goto -> bb4; } @@ -71,3 +71,7 @@ fn range_iter_next(_1: &mut std::ops::Range) -> Option { return; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir index af5d385a979..718dba21a95 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -24,7 +24,7 @@ fn ezmap(_1: Option) -> Option { } bb1: { - _0 = Option::::None; + _0 = const Option::::None; goto -> bb3; } @@ -46,3 +46,7 @@ fn ezmap(_1: Option) -> Option { unreachable; } } + +ALLOC0 (size: 8, align: 4) { + 00 00 00 00 __ __ __ __ │ ....░░░░ +} diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index 05f16cdacce..cc009e45e7e 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -4,239 +4,217 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2 let mut _0: bool; let mut _3: &(usize, usize, usize, usize); let _4: &usize; - let mut _5: &(usize, usize, usize, usize); + let _5: &usize; let _6: &usize; - let mut _7: &(usize, usize, usize, usize); - let _8: &usize; - let mut _9: &(usize, usize, usize, usize); - let _10: &usize; - let mut _11: &&usize; - let _12: &usize; - let mut _13: &&usize; - let mut _18: bool; - let mut _19: &&usize; - let _20: &usize; - let mut _21: &&usize; - let mut _26: bool; - let mut _27: &&usize; - let _28: &usize; - let mut _29: &&usize; - let mut _34: bool; - let mut _35: &&usize; - let _36: &usize; - let mut _37: &&usize; + let _7: &usize; + let mut _8: &&usize; + let _9: &usize; + let mut _10: &&usize; + let mut _15: bool; + let mut _16: &&usize; + let _17: &usize; + let mut _18: &&usize; + let mut _23: bool; + let mut _24: &&usize; + let _25: &usize; + let mut _26: &&usize; + let mut _31: bool; + let mut _32: &&usize; + let _33: &usize; + let mut _34: &&usize; scope 1 { debug a => _4; - debug b => _6; - debug c => _8; - debug d => _10; + debug b => _5; + debug c => _6; + debug d => _7; scope 2 (inlined std::cmp::impls::::le) { - debug self => _11; - debug other => _13; - let mut _14: &usize; - let mut _15: &usize; + debug self => _8; + debug other => _10; + let mut _11: &usize; + let mut _12: &usize; scope 3 (inlined std::cmp::impls::::le) { - debug self => _14; - debug other => _15; - let mut _16: usize; - let mut _17: usize; + debug self => _11; + debug other => _12; + let mut _13: usize; + let mut _14: usize; } } scope 4 (inlined std::cmp::impls::::le) { - debug self => _19; - debug other => _21; - let mut _22: &usize; - let mut _23: &usize; + debug self => _16; + debug other => _18; + let mut _19: &usize; + let mut _20: &usize; scope 5 (inlined std::cmp::impls::::le) { - debug self => _22; - debug other => _23; - let mut _24: usize; - let mut _25: usize; + debug self => _19; + debug other => _20; + let mut _21: usize; + let mut _22: usize; } } scope 6 (inlined std::cmp::impls::::le) { - debug self => _27; - debug other => _29; - let mut _30: &usize; - let mut _31: &usize; + debug self => _24; + debug other => _26; + let mut _27: &usize; + let mut _28: &usize; scope 7 (inlined std::cmp::impls::::le) { - debug self => _30; - debug other => _31; - let mut _32: usize; - let mut _33: usize; + debug self => _27; + debug other => _28; + let mut _29: usize; + let mut _30: usize; } } scope 8 (inlined std::cmp::impls::::le) { - debug self => _35; - debug other => _37; - let mut _38: &usize; - let mut _39: &usize; + debug self => _32; + debug other => _34; + let mut _35: &usize; + let mut _36: &usize; scope 9 (inlined std::cmp::impls::::le) { - debug self => _38; - debug other => _39; - let mut _40: usize; - let mut _41: usize; + debug self => _35; + debug other => _36; + let mut _37: usize; + let mut _38: usize; } } } bb0: { StorageLive(_4); - _3 = deref_copy (*_2); + _3 = (*_2); _4 = &((*_3).0: usize); + StorageLive(_5); + _5 = &((*_3).1: usize); StorageLive(_6); - _5 = deref_copy (*_2); - _6 = &((*_5).1: usize); - StorageLive(_8); - _7 = deref_copy (*_2); - _8 = &((*_7).2: usize); - StorageLive(_10); - _9 = deref_copy (*_2); - _10 = &((*_9).3: usize); - StorageLive(_18); - StorageLive(_11); - _11 = &_4; - StorageLive(_13); - StorageLive(_12); - _12 = _8; - _13 = &_12; - StorageLive(_14); + _6 = &((*_3).2: usize); + StorageLive(_7); + _7 = &((*_3).3: usize); StorageLive(_15); - _14 = deref_copy _4; - _15 = deref_copy _12; - StorageLive(_16); - _16 = (*_14); - StorageLive(_17); - _17 = (*_15); - _18 = Le(move _16, move _17); - StorageDead(_17); - StorageDead(_16); - StorageDead(_15); + StorageLive(_8); + _8 = &_4; + StorageLive(_10); + StorageLive(_9); + _9 = _6; + _10 = &_9; + _11 = _4; + _12 = _9; + StorageLive(_13); + _13 = (*_11); + StorageLive(_14); + _14 = (*_12); + _15 = Le(move _13, move _14); StorageDead(_14); - switchInt(move _18) -> [0: bb1, otherwise: bb2]; + StorageDead(_13); + switchInt(move _15) -> [0: bb1, otherwise: bb2]; } bb1: { - StorageDead(_12); - StorageDead(_13); - StorageDead(_11); + StorageDead(_9); + StorageDead(_10); + StorageDead(_8); goto -> bb4; } bb2: { - StorageDead(_12); - StorageDead(_13); - StorageDead(_11); - StorageLive(_26); - StorageLive(_19); - _19 = &_10; - StorageLive(_21); - StorageLive(_20); - _20 = _6; - _21 = &_20; - StorageLive(_22); + StorageDead(_9); + StorageDead(_10); + StorageDead(_8); StorageLive(_23); - _22 = deref_copy _10; - _23 = deref_copy _20; - StorageLive(_24); - _24 = (*_22); - StorageLive(_25); - _25 = (*_23); - _26 = Le(move _24, move _25); - StorageDead(_25); - StorageDead(_24); - StorageDead(_23); + StorageLive(_16); + _16 = &_7; + StorageLive(_18); + StorageLive(_17); + _17 = _5; + _18 = &_17; + _19 = _7; + _20 = _17; + StorageLive(_21); + _21 = (*_19); + StorageLive(_22); + _22 = (*_20); + _23 = Le(move _21, move _22); StorageDead(_22); - switchInt(move _26) -> [0: bb3, otherwise: bb8]; + StorageDead(_21); + switchInt(move _23) -> [0: bb3, otherwise: bb8]; } bb3: { - StorageDead(_20); - StorageDead(_21); - StorageDead(_19); + StorageDead(_17); + StorageDead(_18); + StorageDead(_16); goto -> bb4; } bb4: { - StorageLive(_34); - StorageLive(_27); - _27 = &_8; - StorageLive(_29); - StorageLive(_28); - _28 = _4; - _29 = &_28; - StorageLive(_30); StorageLive(_31); - _30 = deref_copy _8; - _31 = deref_copy _28; - StorageLive(_32); - _32 = (*_30); - StorageLive(_33); - _33 = (*_31); - _34 = Le(move _32, move _33); - StorageDead(_33); - StorageDead(_32); - StorageDead(_31); + StorageLive(_24); + _24 = &_6; + StorageLive(_26); + StorageLive(_25); + _25 = _4; + _26 = &_25; + _27 = _6; + _28 = _25; + StorageLive(_29); + _29 = (*_27); + StorageLive(_30); + _30 = (*_28); + _31 = Le(move _29, move _30); StorageDead(_30); - switchInt(move _34) -> [0: bb5, otherwise: bb6]; + StorageDead(_29); + switchInt(move _31) -> [0: bb5, otherwise: bb6]; } bb5: { - StorageDead(_28); - StorageDead(_29); - StorageDead(_27); + StorageDead(_25); + StorageDead(_26); + StorageDead(_24); _0 = const false; goto -> bb7; } bb6: { - StorageDead(_28); - StorageDead(_29); - StorageDead(_27); - StorageLive(_35); - _35 = &_6; + StorageDead(_25); + StorageDead(_26); + StorageDead(_24); + StorageLive(_32); + _32 = &_5; + StorageLive(_34); + StorageLive(_33); + _33 = _7; + _34 = &_33; + _35 = _5; + _36 = _33; StorageLive(_37); - StorageLive(_36); - _36 = _10; - _37 = &_36; + _37 = (*_35); StorageLive(_38); - StorageLive(_39); - _38 = deref_copy _6; - _39 = deref_copy _36; - StorageLive(_40); - _40 = (*_38); - StorageLive(_41); - _41 = (*_39); - _0 = Le(move _40, move _41); - StorageDead(_41); - StorageDead(_40); - StorageDead(_39); + _38 = (*_36); + _0 = Le(move _37, move _38); StorageDead(_38); - StorageDead(_36); StorageDead(_37); - StorageDead(_35); + StorageDead(_33); + StorageDead(_34); + StorageDead(_32); goto -> bb7; } bb7: { - StorageDead(_34); + StorageDead(_31); goto -> bb9; } bb8: { - StorageDead(_20); - StorageDead(_21); - StorageDead(_19); + StorageDead(_17); + StorageDead(_18); + StorageDead(_16); _0 = const true; goto -> bb9; } bb9: { - StorageDead(_26); - StorageDead(_18); - StorageDead(_10); - StorageDead(_8); + StorageDead(_23); + StorageDead(_15); + StorageDead(_7); StorageDead(_6); + StorageDead(_5); StorageDead(_4); return; } diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir index e2ed1d101dc..5477796512c 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir @@ -4,46 +4,40 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, let mut _0: bool; let mut _3: &(usize, usize, usize, usize); let _4: usize; - let mut _5: &(usize, usize, usize, usize); + let _5: usize; let _6: usize; - let mut _7: &(usize, usize, usize, usize); - let _8: usize; - let mut _9: &(usize, usize, usize, usize); - let _10: usize; - let mut _11: bool; - let mut _12: bool; - let mut _13: bool; + let _7: usize; + let mut _8: bool; + let mut _9: bool; + let mut _10: bool; scope 1 { debug a => _4; - debug b => _6; - debug c => _8; - debug d => _10; + debug b => _5; + debug c => _6; + debug d => _7; } bb0: { - _3 = deref_copy (*_2); + _3 = (*_2); _4 = ((*_3).0: usize); - _5 = deref_copy (*_2); - _6 = ((*_5).1: usize); - _7 = deref_copy (*_2); - _8 = ((*_7).2: usize); - _9 = deref_copy (*_2); - _10 = ((*_9).3: usize); - StorageLive(_11); - _11 = Le(_4, _8); - switchInt(move _11) -> [0: bb2, otherwise: bb1]; + _5 = ((*_3).1: usize); + _6 = ((*_3).2: usize); + _7 = ((*_3).3: usize); + StorageLive(_8); + _8 = Le(_4, _6); + switchInt(move _8) -> [0: bb2, otherwise: bb1]; } bb1: { - StorageLive(_12); - _12 = Le(_10, _6); - switchInt(move _12) -> [0: bb2, otherwise: bb6]; + StorageLive(_9); + _9 = Le(_7, _5); + switchInt(move _9) -> [0: bb2, otherwise: bb6]; } bb2: { - StorageLive(_13); - _13 = Le(_8, _4); - switchInt(move _13) -> [0: bb3, otherwise: bb4]; + StorageLive(_10); + _10 = Le(_6, _4); + switchInt(move _10) -> [0: bb3, otherwise: bb4]; } bb3: { @@ -52,12 +46,12 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, } bb4: { - _0 = Le(_6, _10); + _0 = Le(_5, _7); goto -> bb5; } bb5: { - StorageDead(_13); + StorageDead(_10); goto -> bb7; } @@ -67,8 +61,8 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, } bb7: { - StorageDead(_12); - StorageDead(_11); + StorageDead(_9); + StorageDead(_8); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index e4d9060d4cf..a12411a0413 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -50,7 +50,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_7); StorageLive(_4); StorageLive(_3); _3 = Len((*_1)); @@ -86,7 +85,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb3: { StorageDead(_4); - StorageDead(_7); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index e4d9060d4cf..a12411a0413 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -50,7 +50,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_7); StorageLive(_4); StorageLive(_3); _3 = Len((*_1)); @@ -86,7 +85,6 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb3: { StorageDead(_4); - StorageDead(_7); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir index db6922968ae..6a99f15774f 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -84,7 +84,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb2: { StorageDead(_8); StorageDead(_7); - _12 = Option::::None; + _12 = const Option::::None; goto -> bb5; } @@ -147,3 +147,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { unreachable; } } + +ALLOC0 (size: 16, align: 8) { + 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index 81d1832eebb..4f028fa0a64 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -84,7 +84,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb2: { StorageDead(_8); StorageDead(_7); - _12 = Option::::None; + _12 = const Option::::None; goto -> bb5; } @@ -155,3 +155,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { resume; } } + +ALLOC0 (size: 16, align: 8) { + 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ +} diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff index 6025abb7382..2bb54d5a666 100644 --- a/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff +++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-abort.diff @@ -3,16 +3,14 @@ fn main() -> () { let mut _0: (); - let mut _1: bool; - let _2: bool; + let _1: bool; scope 1 { - debug x => _2; + debug x => _1; } bb0: { - _2 = const false; -- switchInt(_2) -> [0: bb1, otherwise: bb2]; -+ switchInt(const false) -> [0: bb1, otherwise: bb2]; + _1 = const false; + switchInt(const false) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff index c881dec28c7..2d60e234e06 100644 --- a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff @@ -3,16 +3,14 @@ fn main() -> () { let mut _0: (); - let mut _1: bool; - let _2: bool; + let _1: bool; scope 1 { - debug x => _2; + debug x => _1; } bb0: { - _2 = const false; -- switchInt(_2) -> [0: bb1, otherwise: bb2]; -+ switchInt(const false) -> [0: bb1, otherwise: bb2]; + _1 = const false; + switchInt(const false) -> [0: bb1, otherwise: bb2]; } bb1: {