Skip to content

Commit 7a7bbdb

Browse files
committed
Auto merge of #83118 - erikdesjardins:removezst, r=oli-obk
Rebase and fixup #80493: Remove MIR assignments to ZST types closes #80493 cc `@simonvandel` r? `@oli-obk`
2 parents 2a55274 + 47f8bac commit 7a7bbdb

File tree

41 files changed

+109
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+109
-117
lines changed

compiler/rustc_codegen_ssa/src/mir/analyze.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,18 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
281281
Some(assignment_location) => {
282282
assignment_location.dominates(location, &self.dominators)
283283
}
284-
None => false,
284+
None => {
285+
debug!("No first assignment found for {:?}", local);
286+
// We have not seen any assignment to the local yet,
287+
// but before marking not_ssa, check if it is a ZST,
288+
// in which case we don't need to initialize the local.
289+
let ty = self.fx.mir.local_decls[local].ty;
290+
let ty = self.fx.monomorphize(ty);
291+
292+
let is_zst = self.fx.cx.layout_of(ty).is_zst();
293+
debug!("is_zst: {}", is_zst);
294+
is_zst
295+
}
285296
};
286297
if !ssa_read {
287298
self.not_ssa(local);

compiler/rustc_mir/src/transform/simplify.rs

+52-27
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ use crate::transform::MirPass;
3131
use rustc_index::vec::{Idx, IndexVec};
3232
use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
3333
use rustc_middle::mir::*;
34+
use rustc_middle::ty::ParamEnv;
3435
use rustc_middle::ty::TyCtxt;
3536
use smallvec::SmallVec;
36-
use std::borrow::Cow;
37-
use std::convert::TryInto;
37+
use std::{borrow::Cow, convert::TryInto};
3838

3939
pub struct SimplifyCfg {
4040
label: String,
@@ -326,7 +326,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyLocals {
326326

327327
pub fn simplify_locals<'tcx>(body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>) {
328328
// First, we're going to get a count of *actual* uses for every `Local`.
329-
let mut used_locals = UsedLocals::new(body);
329+
let mut used_locals = UsedLocals::new(body, tcx);
330330

331331
// Next, we're going to remove any `Local` with zero actual uses. When we remove those
332332
// `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals`
@@ -336,7 +336,8 @@ pub fn simplify_locals<'tcx>(body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>) {
336336
remove_unused_definitions(&mut used_locals, body);
337337

338338
// Finally, we'll actually do the work of shrinking `body.local_decls` and remapping the `Local`s.
339-
let map = make_local_map(&mut body.local_decls, &used_locals);
339+
let arg_count = body.arg_count.try_into().unwrap();
340+
let map = make_local_map(&mut body.local_decls, &used_locals, arg_count);
340341

341342
// Only bother running the `LocalUpdater` if we actually found locals to remove.
342343
if map.iter().any(Option::is_none) {
@@ -349,54 +350,61 @@ pub fn simplify_locals<'tcx>(body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>) {
349350
}
350351

351352
/// Construct the mapping while swapping out unused stuff out from the `vec`.
352-
fn make_local_map<V>(
353+
fn make_local_map<'tcx, V>(
353354
local_decls: &mut IndexVec<Local, V>,
354-
used_locals: &UsedLocals,
355+
used_locals: &UsedLocals<'tcx>,
356+
arg_count: u32,
355357
) -> IndexVec<Local, Option<Local>> {
356-
let mut map: IndexVec<Local, Option<Local>> = IndexVec::from_elem(None, &*local_decls);
358+
let mut map: IndexVec<Local, Option<Local>> = IndexVec::from_elem(None, local_decls);
357359
let mut used = Local::new(0);
358360

359361
for alive_index in local_decls.indices() {
360-
// `is_used` treats the `RETURN_PLACE` and arguments as used.
361-
if !used_locals.is_used(alive_index) {
362-
continue;
363-
}
364-
365-
map[alive_index] = Some(used);
366-
if alive_index != used {
367-
local_decls.swap(alive_index, used);
362+
// When creating the local map treat the `RETURN_PLACE` and arguments as used.
363+
if alive_index.as_u32() <= arg_count || used_locals.is_used(alive_index) {
364+
map[alive_index] = Some(used);
365+
if alive_index != used {
366+
local_decls.swap(alive_index, used);
367+
}
368+
used.increment_by(1);
368369
}
369-
used.increment_by(1);
370370
}
371371
local_decls.truncate(used.index());
372372
map
373373
}
374374

375375
/// Keeps track of used & unused locals.
376-
struct UsedLocals {
376+
struct UsedLocals<'tcx> {
377377
increment: bool,
378-
arg_count: u32,
379378
use_count: IndexVec<Local, u32>,
379+
is_static: bool,
380+
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
381+
param_env: ParamEnv<'tcx>,
382+
tcx: TyCtxt<'tcx>,
380383
}
381384

382-
impl UsedLocals {
385+
impl UsedLocals<'tcx> {
383386
/// Determines which locals are used & unused in the given body.
384-
fn new(body: &Body<'_>) -> Self {
387+
fn new(body: &Body<'tcx>, tcx: TyCtxt<'tcx>) -> Self {
388+
let def_id = body.source.def_id();
389+
let is_static = tcx.is_static(def_id);
390+
let param_env = tcx.param_env(def_id);
391+
let local_decls = body.local_decls.clone();
385392
let mut this = Self {
386393
increment: true,
387-
arg_count: body.arg_count.try_into().unwrap(),
388394
use_count: IndexVec::from_elem(0, &body.local_decls),
395+
is_static,
396+
local_decls,
397+
param_env,
398+
tcx,
389399
};
390400
this.visit_body(body);
391401
this
392402
}
393403

394404
/// Checks if local is used.
395-
///
396-
/// Return place and arguments are always considered used.
397405
fn is_used(&self, local: Local) -> bool {
398406
trace!("is_used({:?}): use_count: {:?}", local, self.use_count[local]);
399-
local.as_u32() <= self.arg_count || self.use_count[local] != 0
407+
self.use_count[local] != 0
400408
}
401409

402410
/// Updates the use counts to reflect the removal of given statement.
@@ -424,7 +432,7 @@ impl UsedLocals {
424432
}
425433
}
426434

427-
impl Visitor<'_> for UsedLocals {
435+
impl Visitor<'tcx> for UsedLocals<'tcx> {
428436
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
429437
match statement.kind {
430438
StatementKind::LlvmInlineAsm(..)
@@ -451,7 +459,21 @@ impl Visitor<'_> for UsedLocals {
451459
}
452460
}
453461

454-
fn visit_local(&mut self, local: &Local, _ctx: PlaceContext, _location: Location) {
462+
fn visit_local(&mut self, local: &Local, ctx: PlaceContext, _location: Location) {
463+
debug!("local: {:?} is_static: {:?}, ctx: {:?}", local, self.is_static, ctx);
464+
// Do not count _0 as a used in `return;` if it is a ZST.
465+
let return_place = *local == RETURN_PLACE
466+
&& matches!(ctx, PlaceContext::NonMutatingUse(visit::NonMutatingUseContext::Move));
467+
if !self.is_static && return_place {
468+
let ty = self.local_decls[*local].ty;
469+
let param_env_and = self.param_env.and(ty);
470+
if let Ok(layout) = self.tcx.layout_of(param_env_and) {
471+
debug!("layout.is_zst: {:?}", layout.is_zst());
472+
if layout.is_zst() {
473+
return;
474+
}
475+
}
476+
}
455477
if self.increment {
456478
self.use_count[*local] += 1;
457479
} else {
@@ -462,7 +484,10 @@ impl Visitor<'_> for UsedLocals {
462484
}
463485

464486
/// Removes unused definitions. Updates the used locals to reflect the changes made.
465-
fn remove_unused_definitions<'a, 'tcx>(used_locals: &'a mut UsedLocals, body: &mut Body<'tcx>) {
487+
fn remove_unused_definitions<'a, 'tcx>(
488+
used_locals: &'a mut UsedLocals<'tcx>,
489+
body: &mut Body<'tcx>,
490+
) {
466491
// The use counts are updated as we remove the statements. A local might become unused
467492
// during the retain operation, leading to a temporary inconsistency (storage statements or
468493
// definitions referencing the local might remain). For correctness it is crucial that this

src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ fn hello() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14
55

66
bb0: {
7-
_0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6
87
return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
98
}
109
}

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ fn main() -> () {
2222
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
2323
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
2424
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
25-
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
2625
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2726
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2827
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ fn main() -> () {
2222
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
2323
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
2424
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
25-
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
2625
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2726
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2827
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2

src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
StorageLive(_6); // scope 3 at $DIR/cycle.rs:14:10: 14:11
5757
- _6 = _1; // scope 3 at $DIR/cycle.rs:14:10: 14:11
5858
+ _6 = _4; // scope 3 at $DIR/cycle.rs:14:10: 14:11
59-
_5 = const (); // scope 4 at $DIR/cycle.rs:14:5: 14:12
6059
StorageDead(_6); // scope 3 at $DIR/cycle.rs:14:11: 14:12
6160
StorageDead(_5); // scope 3 at $DIR/cycle.rs:14:12: 14:13
6261
_0 = const (); // scope 0 at $DIR/cycle.rs:8:11: 15:2

src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
StorageLive(_3); // scope 1 at $DIR/union.rs:15:5: 15:27
3232
StorageLive(_4); // scope 1 at $DIR/union.rs:15:10: 15:26
3333
_4 = (_1.0: u32); // scope 2 at $DIR/union.rs:15:19: 15:24
34-
_3 = const (); // scope 3 at $DIR/union.rs:15:5: 15:27
3534
StorageDead(_4); // scope 1 at $DIR/union.rs:15:26: 15:27
3635
StorageDead(_3); // scope 1 at $DIR/union.rs:15:27: 15:28
3736
_0 = const (); // scope 0 at $DIR/union.rs:8:11: 16:2

src/test/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
- }
1717
-
1818
- bb1: {
19-
+ _1 = const (); // scope 1 at $DIR/inline-compatibility.rs:24:5: 24:18
2019
StorageDead(_1); // scope 0 at $DIR/inline-compatibility.rs:24:18: 24:19
2120
_0 = const (); // scope 0 at $DIR/inline-compatibility.rs:23:37: 25:2
2221
return; // scope 0 at $DIR/inline-compatibility.rs:25:2: 25:2

src/test/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
- }
1717
-
1818
- bb1: {
19-
+ _1 = const (); // scope 1 at $DIR/inline-compatibility.rs:13:5: 13:21
2019
StorageDead(_1); // scope 0 at $DIR/inline-compatibility.rs:13:21: 13:22
2120
_0 = const (); // scope 0 at $DIR/inline-compatibility.rs:12:40: 14:2
2221
return; // scope 0 at $DIR/inline-compatibility.rs:14:2: 14:2

src/test/mir-opt/inline/inline_cycle.two.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
+ StorageDead(_5); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
3838
+ StorageDead(_4); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
3939
+ StorageDead(_3); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
40-
+ _1 = const (); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
4140
+ StorageDead(_2); // scope 0 at $DIR/inline-cycle.rs:49:5: 49:12
4241
StorageDead(_1); // scope 0 at $DIR/inline-cycle.rs:49:12: 49:13
4342
_0 = const (); // scope 0 at $DIR/inline-cycle.rs:48:10: 50:2

src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
- }
3737
-
3838
- bb3: {
39-
+ _3 = const (); // scope 1 at $DIR/inline-instruction-set.rs:53:5: 53:30
4039
StorageDead(_3); // scope 0 at $DIR/inline-instruction-set.rs:53:30: 53:31
4140
_0 = const (); // scope 0 at $DIR/inline-instruction-set.rs:50:18: 54:2
4241
return; // scope 0 at $DIR/inline-instruction-set.rs:54:2: 54:2

src/test/mir-opt/inline/inline_instruction_set.t32.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
- }
2828
-
2929
- bb2: {
30-
+ _2 = const (); // scope 1 at $DIR/inline-instruction-set.rs:43:5: 43:26
3130
StorageDead(_2); // scope 0 at $DIR/inline-instruction-set.rs:43:26: 43:27
3231
StorageLive(_3); // scope 0 at $DIR/inline-instruction-set.rs:46:5: 46:30
3332
- _3 = instruction_set_default() -> bb3; // scope 0 at $DIR/inline-instruction-set.rs:46:5: 46:30

src/test/mir-opt/inline/inline_options.main.Inline.after.mir

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ fn main() -> () {
4848

4949
bb4: {
5050
StorageDead(_5); // scope 1 at $DIR/inline-options.rs:10:5: 10:21
51-
_2 = const (); // scope 1 at $DIR/inline-options.rs:10:5: 10:21
5251
StorageDead(_2); // scope 0 at $DIR/inline-options.rs:10:21: 10:22
5352
_0 = const (); // scope 0 at $DIR/inline-options.rs:8:11: 11:2
5453
return; // scope 0 at $DIR/inline-options.rs:11:2: 11:2

src/test/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ fn main() -> () {
2929
_5 = move (_3.0: ()); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3030
StorageLive(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3131
_6 = const (); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
32-
_0 = const (); // scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3332
StorageDead(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3433
StorageDead(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3534
StorageDead(_4); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10

src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
118118
StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
119119
StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
120-
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
121120
StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
122121
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
123122
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2

src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
118118
StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
119119
StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
120-
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
121120
StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
122121
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
123122
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2

src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ fn f_u64() -> () {
2727
StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
2828
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
2929
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21
30-
_0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 36:2
3130
return; // scope 0 at $DIR/lower_intrinsics.rs:36:2: 36:2
3231
}
3332
}

src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ fn f_unit() -> () {
2222
bb1: {
2323
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
2424
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:29:18: 29:19
25-
_0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:28:17: 30:2
2625
return; // scope 0 at $DIR/lower_intrinsics.rs:30:2: 30:2
2726
}
2827
}

src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff

+16-13
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@
55
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11
66
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25
77
let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
8+
+ let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
89

910
bb0: {
1011
_2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
11-
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
12-
}
13-
14-
bb1: {
15-
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:10:6: 10:6
16-
goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
17-
}
18-
19-
bb2: {
20-
goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
21-
}
22-
23-
bb3: {
12+
- switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
13+
- }
14+
-
15+
- bb1: {
16+
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
17+
- }
18+
-
19+
- bb2: {
20+
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
21+
- }
22+
-
23+
- bb3: {
24+
+ StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
25+
+ _3 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
26+
+ StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
2427
return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2
2528
}
2629
}

src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff

+16-13
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@
55
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11
66
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25
77
let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
8+
+ let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
89

910
bb0: {
1011
_2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
11-
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
12-
}
13-
14-
bb1: {
15-
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:10:6: 10:6
16-
goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
17-
}
18-
19-
bb2: {
20-
goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
21-
}
22-
23-
bb3: {
12+
- switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
13+
- }
14+
-
15+
- bb1: {
16+
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
17+
- }
18+
-
19+
- bb2: {
20+
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
21+
- }
22+
-
23+
- bb3: {
24+
+ StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
25+
+ _3 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
26+
+ StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
2427
return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2
2528
}
2629
}

0 commit comments

Comments
 (0)