Auto merge of #123256 - saethlin:instsimplify-earlier, r= · rust-lang/rust@49d1f0a (original) (raw)
32 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -581,6 +581,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { | ||
581 | 581 | &remove_unneeded_drops::RemoveUnneededDrops, |
582 | 582 | // Type instantiation may create uninhabited enums. |
583 | 583 | &uninhabited_enum_branching::UninhabitedEnumBranching, |
584 | +&instsimplify::InstSimplify, | |
584 | 585 | &unreachable_prop::UnreachablePropagation, |
585 | 586 | &o1(simplify::SimplifyCfg::AfterUninhabitedEnumBranching), |
586 | 587 | // Inlining may have introduced a lot of redundant code and a large move pattern. |
@@ -593,7 +594,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { | ||
593 | 594 | &match_branches::MatchBranchSimplification, |
594 | 595 | // inst combine is after MatchBranchSimplification to clean up Ne(_1, false) |
595 | 596 | &multiple_return_terminators::MultipleReturnTerminators, |
596 | -&instsimplify::InstSimplify, | |
597 | 597 | &simplify::SimplifyLocals::BeforeConstProp, |
598 | 598 | &dead_store_elimination::DeadStoreElimination::Initial, |
599 | 599 | &gvn::GVN, |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -23,12 +23,12 @@ | ||
23 | 23 | debug ptr => _6; |
24 | 24 | scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { |
25 | 25 | debug ptr => _6; |
26 | - let mut _8: bool; | |
27 | - let _9: (); | |
28 | - let mut _10: *mut (); | |
29 | - let mut _11: *const [bool; 0]; | |
26 | + let _8: (); | |
27 | + let mut _9: *mut (); | |
28 | + let mut _10: *const [bool; 0]; | |
30 | 29 | scope 13 { |
31 | 30 | scope 14 (inlined core::ub_checks::check_language_ub) { |
31 | + let mut _11: bool; | |
32 | 32 | scope 15 (inlined core::ub_checks::check_language_ub::runtime) { |
33 | 33 | } |
34 | 34 | } |
@@ -54,18 +54,18 @@ | ||
54 | 54 | StorageLive(_1); |
55 | 55 | StorageLive(_2); |
56 | 56 | StorageLive(_3); |
57 | - StorageLive(_9); | |
57 | + StorageLive(_8); | |
58 | 58 | StorageLive(_4); |
59 | 59 | StorageLive(_5); |
60 | 60 | StorageLive(_6); |
61 | 61 | StorageLive(_7); |
62 | 62 | _7 = const 1_usize; |
63 | 63 | _6 = const {0x1 as *mut [bool; 0]}; |
64 | 64 | StorageDead(_7); |
65 | + StorageLive(_10); | |
65 | 66 | StorageLive(_11); |
66 | - StorageLive(_8); | |
67 | - _8 = UbChecks(); | |
68 | - switchInt(move _8) -> [0: bb4, otherwise: bb2]; | |
67 | + _11 = UbChecks(); | |
68 | + switchInt(_11) -> [0: bb4, otherwise: bb2]; | |
69 | 69 | } |
70 | 70 | |
71 | 71 | bb1: { |
@@ -74,28 +74,28 @@ | ||
74 | 74 | } |
75 | 75 | |
76 | 76 | bb2: { |
77 | - StorageLive(_10); | |
78 | -_10 = const {0x1 as *mut ()}; | |
79 | -_9 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable]; | |
77 | + StorageLive(_9); | |
78 | +_9 = const {0x1 as *mut ()}; | |
79 | +_8 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable]; | |
80 | 80 | } |
81 | 81 | |
82 | 82 | bb3: { |
83 | - StorageDead(_10); | |
83 | + StorageDead(_9); | |
84 | 84 | goto -> bb4; |
85 | 85 | } |
86 | 86 | |
87 | 87 | bb4: { |
88 | - StorageDead(_8); | |
89 | - _11 = const {0x1 as *const [bool; 0]}; | |
88 | + _10 = const {0x1 as *const [bool; 0]}; | |
90 | 89 | _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; |
91 | 90 | StorageDead(_11); |
91 | + StorageDead(_10); | |
92 | 92 | StorageDead(_6); |
93 | 93 | _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; |
94 | 94 | StorageDead(_5); |
95 | 95 | _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; |
96 | 96 | StorageDead(_4); |
97 | 97 | _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); |
98 | - StorageDead(_9); | |
98 | + StorageDead(_8); | |
99 | 99 | StorageDead(_3); |
100 | 100 | _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; |
101 | 101 | StorageDead(_2); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -23,12 +23,12 @@ | ||
23 | 23 | debug ptr => _6; |
24 | 24 | scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { |
25 | 25 | debug ptr => _6; |
26 | - let mut _8: bool; | |
27 | - let _9: (); | |
28 | - let mut _10: *mut (); | |
29 | - let mut _11: *const [bool; 0]; | |
26 | + let _8: (); | |
27 | + let mut _9: *mut (); | |
28 | + let mut _10: *const [bool; 0]; | |
30 | 29 | scope 13 { |
31 | 30 | scope 14 (inlined core::ub_checks::check_language_ub) { |
31 | + let mut _11: bool; | |
32 | 32 | scope 15 (inlined core::ub_checks::check_language_ub::runtime) { |
33 | 33 | } |
34 | 34 | } |
@@ -54,18 +54,18 @@ | ||
54 | 54 | StorageLive(_1); |
55 | 55 | StorageLive(_2); |
56 | 56 | StorageLive(_3); |
57 | - StorageLive(_9); | |
57 | + StorageLive(_8); | |
58 | 58 | StorageLive(_4); |
59 | 59 | StorageLive(_5); |
60 | 60 | StorageLive(_6); |
61 | 61 | StorageLive(_7); |
62 | 62 | _7 = const 1_usize; |
63 | 63 | _6 = const {0x1 as *mut [bool; 0]}; |
64 | 64 | StorageDead(_7); |
65 | + StorageLive(_10); | |
65 | 66 | StorageLive(_11); |
66 | - StorageLive(_8); | |
67 | - _8 = UbChecks(); | |
68 | - switchInt(move _8) -> [0: bb5, otherwise: bb3]; | |
67 | + _11 = UbChecks(); | |
68 | + switchInt(_11) -> [0: bb5, otherwise: bb3]; | |
69 | 69 | } |
70 | 70 | |
71 | 71 | bb1: { |
@@ -78,28 +78,28 @@ | ||
78 | 78 | } |
79 | 79 | |
80 | 80 | bb3: { |
81 | - StorageLive(_10); | |
82 | -_10 = const {0x1 as *mut ()}; | |
83 | -_9 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable]; | |
81 | + StorageLive(_9); | |
82 | +_9 = const {0x1 as *mut ()}; | |
83 | +_8 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable]; | |
84 | 84 | } |
85 | 85 | |
86 | 86 | bb4: { |
87 | - StorageDead(_10); | |
87 | + StorageDead(_9); | |
88 | 88 | goto -> bb5; |
89 | 89 | } |
90 | 90 | |
91 | 91 | bb5: { |
92 | - StorageDead(_8); | |
93 | - _11 = const {0x1 as *const [bool; 0]}; | |
92 | + _10 = const {0x1 as *const [bool; 0]}; | |
94 | 93 | _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; |
95 | 94 | StorageDead(_11); |
95 | + StorageDead(_10); | |
96 | 96 | StorageDead(_6); |
97 | 97 | _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; |
98 | 98 | StorageDead(_5); |
99 | 99 | _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; |
100 | 100 | StorageDead(_4); |
101 | 101 | _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); |
102 | - StorageDead(_9); | |
102 | + StorageDead(_8); | |
103 | 103 | StorageDead(_3); |
104 | 104 | _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; |
105 | 105 | StorageDead(_2); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -23,12 +23,12 @@ | ||
23 | 23 | debug ptr => _6; |
24 | 24 | scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { |
25 | 25 | debug ptr => _6; |
26 | - let mut _8: bool; | |
27 | - let _9: (); | |
28 | - let mut _10: *mut (); | |
29 | - let mut _11: *const [bool; 0]; | |
26 | + let _8: (); | |
27 | + let mut _9: *mut (); | |
28 | + let mut _10: *const [bool; 0]; | |
30 | 29 | scope 13 { |
31 | 30 | scope 14 (inlined core::ub_checks::check_language_ub) { |
31 | + let mut _11: bool; | |
32 | 32 | scope 15 (inlined core::ub_checks::check_language_ub::runtime) { |
33 | 33 | } |
34 | 34 | } |
@@ -54,18 +54,18 @@ | ||
54 | 54 | StorageLive(_1); |
55 | 55 | StorageLive(_2); |
56 | 56 | StorageLive(_3); |
57 | - StorageLive(_9); | |
57 | + StorageLive(_8); | |
58 | 58 | StorageLive(_4); |
59 | 59 | StorageLive(_5); |
60 | 60 | StorageLive(_6); |
61 | 61 | StorageLive(_7); |
62 | 62 | _7 = const 1_usize; |
63 | 63 | _6 = const {0x1 as *mut [bool; 0]}; |
64 | 64 | StorageDead(_7); |
65 | + StorageLive(_10); | |
65 | 66 | StorageLive(_11); |
66 | - StorageLive(_8); | |
67 | - _8 = UbChecks(); | |
68 | - switchInt(move _8) -> [0: bb4, otherwise: bb2]; | |
67 | + _11 = UbChecks(); | |
68 | + switchInt(_11) -> [0: bb4, otherwise: bb2]; | |
69 | 69 | } |
70 | 70 | |
71 | 71 | bb1: { |
@@ -74,28 +74,28 @@ | ||
74 | 74 | } |
75 | 75 | |
76 | 76 | bb2: { |
77 | - StorageLive(_10); | |
78 | -_10 = const {0x1 as *mut ()}; | |
79 | -_9 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable]; | |
77 | + StorageLive(_9); | |
78 | +_9 = const {0x1 as *mut ()}; | |
79 | +_8 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable]; | |
80 | 80 | } |
81 | 81 | |
82 | 82 | bb3: { |
83 | - StorageDead(_10); | |
83 | + StorageDead(_9); | |
84 | 84 | goto -> bb4; |
85 | 85 | } |
86 | 86 | |
87 | 87 | bb4: { |
88 | - StorageDead(_8); | |
89 | - _11 = const {0x1 as *const [bool; 0]}; | |
88 | + _10 = const {0x1 as *const [bool; 0]}; | |
90 | 89 | _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; |
91 | 90 | StorageDead(_11); |
91 | + StorageDead(_10); | |
92 | 92 | StorageDead(_6); |
93 | 93 | _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; |
94 | 94 | StorageDead(_5); |
95 | 95 | _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; |
96 | 96 | StorageDead(_4); |
97 | 97 | _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); |
98 | - StorageDead(_9); | |
98 | + StorageDead(_8); | |
99 | 99 | StorageDead(_3); |
100 | 100 | _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; |
101 | 101 | StorageDead(_2); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -23,12 +23,12 @@ | ||
23 | 23 | debug ptr => _6; |
24 | 24 | scope 12 (inlined NonNull::<[bool; 0]>::new_unchecked) { |
25 | 25 | debug ptr => _6; |
26 | - let mut _8: bool; | |
27 | - let _9: (); | |
28 | - let mut _10: *mut (); | |
29 | - let mut _11: *const [bool; 0]; | |
26 | + let _8: (); | |
27 | + let mut _9: *mut (); | |
28 | + let mut _10: *const [bool; 0]; | |
30 | 29 | scope 13 { |
31 | 30 | scope 14 (inlined core::ub_checks::check_language_ub) { |
31 | + let mut _11: bool; | |
32 | 32 | scope 15 (inlined core::ub_checks::check_language_ub::runtime) { |
33 | 33 | } |
34 | 34 | } |
@@ -54,18 +54,18 @@ | ||
54 | 54 | StorageLive(_1); |
55 | 55 | StorageLive(_2); |
56 | 56 | StorageLive(_3); |
57 | - StorageLive(_9); | |
57 | + StorageLive(_8); | |
58 | 58 | StorageLive(_4); |
59 | 59 | StorageLive(_5); |
60 | 60 | StorageLive(_6); |
61 | 61 | StorageLive(_7); |
62 | 62 | _7 = const 1_usize; |
63 | 63 | _6 = const {0x1 as *mut [bool; 0]}; |
64 | 64 | StorageDead(_7); |
65 | + StorageLive(_10); | |
65 | 66 | StorageLive(_11); |
66 | - StorageLive(_8); | |
67 | - _8 = UbChecks(); | |
68 | - switchInt(move _8) -> [0: bb5, otherwise: bb3]; | |
67 | + _11 = UbChecks(); | |
68 | + switchInt(_11) -> [0: bb5, otherwise: bb3]; | |
69 | 69 | } |
70 | 70 | |
71 | 71 | bb1: { |
@@ -78,28 +78,28 @@ | ||
78 | 78 | } |
79 | 79 | |
80 | 80 | bb3: { |
81 | - StorageLive(_10); | |
82 | -_10 = const {0x1 as *mut ()}; | |
83 | -_9 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable]; | |
81 | + StorageLive(_9); | |
82 | +_9 = const {0x1 as *mut ()}; | |
83 | +_8 = NonNull::::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable]; | |
84 | 84 | } |
85 | 85 | |
86 | 86 | bb4: { |
87 | - StorageDead(_10); | |
87 | + StorageDead(_9); | |
88 | 88 | goto -> bb5; |
89 | 89 | } |
90 | 90 | |
91 | 91 | bb5: { |
92 | - StorageDead(_8); | |
93 | - _11 = const {0x1 as *const [bool; 0]}; | |
92 | + _10 = const {0x1 as *const [bool; 0]}; | |
94 | 93 | _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; |
95 | 94 | StorageDead(_11); |
95 | + StorageDead(_10); | |
96 | 96 | StorageDead(_6); |
97 | 97 | _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }}; |
98 | 98 | StorageDead(_5); |
99 | 99 | _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; |
100 | 100 | StorageDead(_4); |
101 | 101 | _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); |
102 | - StorageDead(_9); | |
102 | + StorageDead(_8); | |
103 | 103 | StorageDead(_3); |
104 | 104 | _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; |
105 | 105 | StorageDead(_2); |