4 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,8 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
168
168
} ;
169
169
( value, targets. target_for_value ( value) )
170
170
} ) ;
171
- let eq_targets = SwitchTargets :: new ( eq_new_targets, opt_data. destination ) ;
171
+ // The otherwise either is the same target branch or an unreachable.
172
+ let eq_targets = SwitchTargets :: new ( eq_new_targets, parent_targets. otherwise ( ) ) ;
172
173
173
174
// Create `bbEq` in example above
174
175
let eq_switch = BasicBlockData :: new ( Some ( Terminator {
Original file line number Diff line number Diff line change 37
37
+ StorageLive(_13);
38
38
+ _13 = Ne(_9, move _12);
39
39
+ StorageDead(_12);
40
- + switchInt(move _13) -> [0: bb6 , otherwise: bb1];
40
+ + switchInt(move _13) -> [0: bb7 , otherwise: bb1];
41
41
}
42
42
43
43
bb1: {
95
95
}
96
96
97
97
- bb9: {
98
- - unreachable;
99
98
+ bb6: {
99
+ unreachable;
100
+ + }
101
+ +
102
+ + bb7: {
100
103
+ StorageDead(_13);
101
- + switchInt(_9) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb1 ];
104
+ + switchInt(_9) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb6 ];
102
105
}
103
106
}
104
107
Original file line number Diff line number Diff line change 37
37
+ StorageLive(_13);
38
38
+ _13 = Ne(_9, move _12);
39
39
+ StorageDead(_12);
40
- + switchInt(move _13) -> [0: bb6 , otherwise: bb1];
40
+ + switchInt(move _13) -> [0: bb7 , otherwise: bb1];
41
41
}
42
42
43
43
bb1: {
95
95
}
96
96
97
97
- bb9: {
98
- - unreachable;
99
98
+ bb6: {
99
+ unreachable;
100
+ + }
101
+ +
102
+ + bb7: {
100
103
+ StorageDead(_13);
101
- + switchInt(_9) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb1 ];
104
+ + switchInt(_9) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb6 ];
102
105
}
103
106
}
104
107
Original file line number Diff line number Diff line change 47
47
+ StorageLive(_19);
48
48
+ _19 = Ne(_14, move _18);
49
49
+ StorageDead(_18);
50
- + switchInt(move _19) -> [0: bb9 , otherwise: bb1];
50
+ + switchInt(move _19) -> [0: bb10 , otherwise: bb1];
51
51
}
52
52
53
53
bb1: {
129
129
}
130
130
131
131
- bb12: {
132
- - unreachable;
133
132
+ bb9: {
133
+ unreachable;
134
+ + }
135
+ +
136
+ + bb10: {
134
137
+ StorageDead(_19);
135
- + switchInt(_14) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb1 ];
138
+ + switchInt(_14) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb9 ];
136
139
}
137
140
}
138
141
0 commit comments