1
Fork 0

Start blocks eagerly

This commit is contained in:
Nadrieril 2024-02-12 04:56:03 +01:00
parent f4cfd87202
commit faaf81bbbc
66 changed files with 802 additions and 693 deletions

View file

@ -319,7 +319,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// them. // them.
let mut fake_borrows = match_has_guard.then(FxIndexSet::default); let mut fake_borrows = match_has_guard.then(FxIndexSet::default);
let mut otherwise = None; let otherwise_block = self.cfg.start_new_block();
// This will generate code to test scrutinee_place and // This will generate code to test scrutinee_place and
// branch to the appropriate arm block // branch to the appropriate arm block
@ -327,46 +327,44 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
match_start_span, match_start_span,
scrutinee_span, scrutinee_span,
block, block,
&mut otherwise, otherwise_block,
candidates, candidates,
&mut fake_borrows, &mut fake_borrows,
); );
if let Some(otherwise_block) = otherwise { // See the doc comment on `match_candidates` for why we may have an
// See the doc comment on `match_candidates` for why we may have an // otherwise block. Match checking will ensure this is actually
// otherwise block. Match checking will ensure this is actually // unreachable.
// unreachable. let source_info = self.source_info(scrutinee_span);
let source_info = self.source_info(scrutinee_span);
// Matching on a `scrutinee_place` with an uninhabited type doesn't // Matching on a `scrutinee_place` with an uninhabited type doesn't
// generate any memory reads by itself, and so if the place "expression" // generate any memory reads by itself, and so if the place "expression"
// contains unsafe operations like raw pointer dereferences or union // contains unsafe operations like raw pointer dereferences or union
// field projections, we wouldn't know to require an `unsafe` block // field projections, we wouldn't know to require an `unsafe` block
// around a `match` equivalent to `std::intrinsics::unreachable()`. // around a `match` equivalent to `std::intrinsics::unreachable()`.
// See issue #47412 for this hole being discovered in the wild. // See issue #47412 for this hole being discovered in the wild.
// //
// HACK(eddyb) Work around the above issue by adding a dummy inspection // HACK(eddyb) Work around the above issue by adding a dummy inspection
// of `scrutinee_place`, specifically by applying `ReadForMatch`. // of `scrutinee_place`, specifically by applying `ReadForMatch`.
// //
// NOTE: ReadForMatch also checks that the scrutinee is initialized. // NOTE: ReadForMatch also checks that the scrutinee is initialized.
// This is currently needed to not allow matching on an uninitialized, // This is currently needed to not allow matching on an uninitialized,
// uninhabited value. If we get never patterns, those will check that // uninhabited value. If we get never patterns, those will check that
// the place is initialized, and so this read would only be used to // the place is initialized, and so this read would only be used to
// check safety. // check safety.
let cause_matched_place = FakeReadCause::ForMatchedPlace(None); let cause_matched_place = FakeReadCause::ForMatchedPlace(None);
if let Some(scrutinee_place) = scrutinee_place_builder.try_to_place(self) { if let Some(scrutinee_place) = scrutinee_place_builder.try_to_place(self) {
self.cfg.push_fake_read( self.cfg.push_fake_read(
otherwise_block, otherwise_block,
source_info, source_info,
cause_matched_place, cause_matched_place,
scrutinee_place, scrutinee_place,
); );
}
self.cfg.terminate(otherwise_block, source_info, TerminatorKind::Unreachable);
} }
self.cfg.terminate(otherwise_block, source_info, TerminatorKind::Unreachable);
// Link each leaf candidate to the `pre_binding_block` of the next one. // Link each leaf candidate to the `pre_binding_block` of the next one.
let mut previous_candidate: Option<&mut Candidate<'_, '_>> = None; let mut previous_candidate: Option<&mut Candidate<'_, '_>> = None;
@ -1163,7 +1161,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
span: Span, span: Span,
scrutinee_span: Span, scrutinee_span: Span,
start_block: BasicBlock, start_block: BasicBlock,
otherwise_block: &mut Option<BasicBlock>, otherwise_block: BasicBlock,
candidates: &mut [&mut Candidate<'pat, 'tcx>], candidates: &mut [&mut Candidate<'pat, 'tcx>],
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>, fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
) { ) {
@ -1210,7 +1208,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
span: Span, span: Span,
scrutinee_span: Span, scrutinee_span: Span,
start_block: BasicBlock, start_block: BasicBlock,
otherwise_block: &mut Option<BasicBlock>, otherwise_block: BasicBlock,
candidates: &mut [&mut Candidate<'_, 'tcx>], candidates: &mut [&mut Candidate<'_, 'tcx>],
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>, fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
) { ) {
@ -1243,11 +1241,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// never reach this point. // never reach this point.
if unmatched_candidates.is_empty() { if unmatched_candidates.is_empty() {
let source_info = self.source_info(span); let source_info = self.source_info(span);
if let Some(otherwise) = *otherwise_block { self.cfg.goto(block, source_info, otherwise_block);
self.cfg.goto(block, source_info, otherwise);
} else {
*otherwise_block = Some(block);
}
return; return;
} }
@ -1428,7 +1422,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
scrutinee_span: Span, scrutinee_span: Span,
candidates: &mut [&mut Candidate<'_, 'tcx>], candidates: &mut [&mut Candidate<'_, 'tcx>],
block: BasicBlock, block: BasicBlock,
otherwise_block: &mut Option<BasicBlock>, otherwise_block: BasicBlock,
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>, fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
) { ) {
let (first_candidate, remaining_candidates) = candidates.split_first_mut().unwrap(); let (first_candidate, remaining_candidates) = candidates.split_first_mut().unwrap();
@ -1453,7 +1447,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let match_pairs = mem::take(&mut first_candidate.match_pairs); let match_pairs = mem::take(&mut first_candidate.match_pairs);
first_candidate.pre_binding_block = Some(block); first_candidate.pre_binding_block = Some(block);
let mut otherwise = None; let remainder_start = self.cfg.start_new_block();
for match_pair in match_pairs { for match_pair in match_pairs {
let PatKind::Or { ref pats } = &match_pair.pattern.kind else { let PatKind::Or { ref pats } = &match_pair.pattern.kind else {
bug!("Or-patterns should have been sorted to the end"); bug!("Or-patterns should have been sorted to the end");
@ -1463,7 +1457,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
first_candidate.visit_leaves(|leaf_candidate| { first_candidate.visit_leaves(|leaf_candidate| {
self.test_or_pattern( self.test_or_pattern(
leaf_candidate, leaf_candidate,
&mut otherwise, remainder_start,
pats, pats,
or_span, or_span,
&match_pair.place, &match_pair.place,
@ -1472,8 +1466,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}); });
} }
let remainder_start = otherwise.unwrap_or_else(|| self.cfg.start_new_block());
self.match_candidates( self.match_candidates(
span, span,
scrutinee_span, scrutinee_span,
@ -1491,7 +1483,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
fn test_or_pattern<'pat>( fn test_or_pattern<'pat>(
&mut self, &mut self,
candidate: &mut Candidate<'pat, 'tcx>, candidate: &mut Candidate<'pat, 'tcx>,
otherwise: &mut Option<BasicBlock>, otherwise: BasicBlock,
pats: &'pat [Box<Pat<'tcx>>], pats: &'pat [Box<Pat<'tcx>>],
or_span: Span, or_span: Span,
place: &PlaceBuilder<'tcx>, place: &PlaceBuilder<'tcx>,
@ -1503,8 +1495,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
.map(|pat| Candidate::new(place.clone(), pat, candidate.has_guard, self)) .map(|pat| Candidate::new(place.clone(), pat, candidate.has_guard, self))
.collect(); .collect();
let mut or_candidate_refs: Vec<_> = or_candidates.iter_mut().collect(); let mut or_candidate_refs: Vec<_> = or_candidates.iter_mut().collect();
let otherwise = if candidate.otherwise_block.is_some() { let otherwise = if let Some(otherwise_block) = candidate.otherwise_block {
&mut candidate.otherwise_block otherwise_block
} else { } else {
otherwise otherwise
}; };
@ -1680,8 +1672,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
span: Span, span: Span,
scrutinee_span: Span, scrutinee_span: Span,
mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>], mut candidates: &'b mut [&'c mut Candidate<'pat, 'tcx>],
block: BasicBlock, start_block: BasicBlock,
otherwise_block: &mut Option<BasicBlock>, otherwise_block: BasicBlock,
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>, fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
) { ) {
// extract the match-pair from the highest priority candidate // extract the match-pair from the highest priority candidate
@ -1749,12 +1741,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
debug!("untested_candidates: {}", candidates.len()); debug!("untested_candidates: {}", candidates.len());
// The block that we should branch to if none of the // The block that we should branch to if none of the
// `target_candidates` match. This is either the block where we // `target_candidates` match.
// start matching the untested candidates if there are any, let remainder_start = if !candidates.is_empty() {
// otherwise it's the `otherwise_block`. let remainder_start = self.cfg.start_new_block();
let remainder_start = &mut None; self.match_candidates(
let remainder_start = span,
if candidates.is_empty() { &mut *otherwise_block } else { remainder_start }; scrutinee_span,
remainder_start,
otherwise_block,
candidates,
fake_borrows,
);
remainder_start
} else {
otherwise_block
};
// For each outcome of test, process the candidates that still // For each outcome of test, process the candidates that still
// apply. Collect a list of blocks where control flow will // apply. Collect a list of blocks where control flow will
@ -1775,24 +1776,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
); );
candidate_start candidate_start
} else { } else {
*remainder_start.get_or_insert_with(|| self.cfg.start_new_block()) remainder_start
} }
}) })
.collect(); .collect();
if !candidates.is_empty() { // Perform the test, branching to one of N blocks.
let remainder_start = remainder_start.unwrap_or_else(|| self.cfg.start_new_block()); self.perform_test(span, scrutinee_span, start_block, &match_place, &test, target_blocks);
self.match_candidates(
span,
scrutinee_span,
remainder_start,
otherwise_block,
candidates,
fake_borrows,
);
}
self.perform_test(span, scrutinee_span, block, &match_place, &test, target_blocks);
} }
/// Determine the fake borrows that are needed from a set of places that /// Determine the fake borrows that are needed from a set of places that

View file

@ -110,7 +110,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>,
bb0: { bb0: {
_39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))); _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})));
switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb9]; switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb8];
} }
bb1: { bb1: {
@ -165,10 +165,14 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>,
StorageDead(_10); StorageDead(_10);
PlaceMention(_9); PlaceMention(_9);
_16 = discriminant(_9); _16 = discriminant(_9);
switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; switchInt(move _16) -> [0: bb10, 1: bb9, otherwise: bb8];
} }
bb8: { bb8: {
unreachable;
}
bb9: {
_8 = const (); _8 = const ();
StorageDead(_14); StorageDead(_14);
StorageDead(_12); StorageDead(_12);
@ -186,10 +190,6 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>,
return; return;
} }
bb9: {
unreachable;
}
bb10: { bb10: {
StorageLive(_17); StorageLive(_17);
_17 = ((_9 as Ready).0: ()); _17 = ((_9 as Ready).0: ());
@ -267,7 +267,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>,
StorageDead(_26); StorageDead(_26);
PlaceMention(_25); PlaceMention(_25);
_32 = discriminant(_25); _32 = discriminant(_25);
switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb8];
} }
bb20: { bb20: {

View file

@ -27,13 +27,13 @@ fn main() -> () {
StorageLive(_5); StorageLive(_5);
PlaceMention(_1); PlaceMention(_1);
_6 = discriminant(_1); _6 = discriminant(_1);
switchInt(move _6) -> [1: bb4, otherwise: bb3]; switchInt(move _6) -> [1: bb5, otherwise: bb4];
} }
bb1: { bb1: {
StorageLive(_3); StorageLive(_3);
StorageLive(_4); StorageLive(_4);
_4 = begin_panic::<&str>(const "explicit panic") -> bb7; _4 = begin_panic::<&str>(const "explicit panic") -> bb8;
} }
bb2: { bb2: {
@ -43,14 +43,19 @@ fn main() -> () {
} }
bb3: { bb3: {
goto -> bb6; FakeRead(ForMatchedPlace(None), _1);
unreachable;
} }
bb4: { bb4: {
falseEdge -> [real: bb5, imaginary: bb3]; goto -> bb7;
} }
bb5: { bb5: {
falseEdge -> [real: bb6, imaginary: bb4];
}
bb6: {
_5 = ((_1 as Some).0: u8); _5 = ((_1 as Some).0: u8);
_0 = const (); _0 = const ();
StorageDead(_5); StorageDead(_5);
@ -58,12 +63,12 @@ fn main() -> () {
return; return;
} }
bb6: { bb7: {
StorageDead(_5); StorageDead(_5);
goto -> bb1; goto -> bb1;
} }
bb7 (cleanup): { bb8 (cleanup): {
resume; resume;
} }
} }

View file

@ -17,7 +17,7 @@ fn main() -> () {
} }
bb1: { bb1: {
falseUnwind -> [real: bb2, unwind: bb11]; falseUnwind -> [real: bb2, unwind: bb12];
} }
bb2: { bb2: {
@ -25,41 +25,46 @@ fn main() -> () {
StorageLive(_3); StorageLive(_3);
_3 = const true; _3 = const true;
PlaceMention(_3); PlaceMention(_3);
switchInt(_3) -> [0: bb3, otherwise: bb4]; switchInt(_3) -> [0: bb4, otherwise: bb5];
} }
bb3: { bb3: {
falseEdge -> [real: bb5, imaginary: bb4]; FakeRead(ForMatchedPlace(None), _3);
}
bb4: {
_0 = const ();
goto -> bb10;
}
bb5: {
_2 = const 4_i32;
goto -> bb8;
}
bb6: {
unreachable; unreachable;
} }
bb4: {
falseEdge -> [real: bb6, imaginary: bb5];
}
bb5: {
_0 = const ();
goto -> bb11;
}
bb6: {
_2 = const 4_i32;
goto -> bb9;
}
bb7: { bb7: {
goto -> bb8; unreachable;
} }
bb8: { bb8: {
goto -> bb9;
}
bb9: {
FakeRead(ForLet(None), _2); FakeRead(ForLet(None), _2);
StorageDead(_3); StorageDead(_3);
StorageLive(_5); StorageLive(_5);
StorageLive(_6); StorageLive(_6);
_6 = &_2; _6 = &_2;
_5 = std::mem::drop::<&i32>(move _6) -> [return: bb9, unwind: bb11]; _5 = std::mem::drop::<&i32>(move _6) -> [return: bb10, unwind: bb12];
} }
bb9: { bb10: {
StorageDead(_6); StorageDead(_6);
StorageDead(_5); StorageDead(_5);
_1 = const (); _1 = const ();
@ -67,13 +72,13 @@ fn main() -> () {
goto -> bb1; goto -> bb1;
} }
bb10: { bb11: {
StorageDead(_3); StorageDead(_3);
StorageDead(_2); StorageDead(_2);
return; return;
} }
bb11 (cleanup): { bb12 (cleanup): {
resume; resume;
} }
} }

View file

@ -19,168 +19,178 @@ fn test_complex() -> () {
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
StorageLive(_2); StorageLive(_2);
_2 = E::f() -> [return: bb1, unwind: bb31]; _2 = E::f() -> [return: bb1, unwind: bb33];
} }
bb1: { bb1: {
PlaceMention(_2); PlaceMention(_2);
_3 = discriminant(_2); _3 = discriminant(_2);
switchInt(move _3) -> [0: bb2, otherwise: bb3]; switchInt(move _3) -> [0: bb4, otherwise: bb3];
} }
bb2: { bb2: {
falseEdge -> [real: bb4, imaginary: bb3]; FakeRead(ForMatchedPlace(None), _2);
unreachable;
} }
bb3: { bb3: {
goto -> bb19; goto -> bb20;
} }
bb4: { bb4: {
StorageLive(_4); falseEdge -> [real: bb5, imaginary: bb3];
_4 = always_true() -> [return: bb5, unwind: bb31];
} }
bb5: { bb5: {
switchInt(move _4) -> [0: bb7, otherwise: bb6]; StorageLive(_4);
_4 = always_true() -> [return: bb6, unwind: bb33];
} }
bb6: { bb6: {
switchInt(move _4) -> [0: bb8, otherwise: bb7];
}
bb7: {
StorageLive(_5); StorageLive(_5);
StorageLive(_6); StorageLive(_6);
StorageLive(_7); StorageLive(_7);
_7 = Droppy(const 0_u8); _7 = Droppy(const 0_u8);
_6 = (_7.0: u8); _6 = (_7.0: u8);
_5 = Gt(move _6, const 0_u8); _5 = Gt(move _6, const 0_u8);
switchInt(move _5) -> [0: bb9, otherwise: bb8]; switchInt(move _5) -> [0: bb10, otherwise: bb9];
}
bb7: {
goto -> bb13;
} }
bb8: { bb8: {
drop(_7) -> [return: bb10, unwind: bb31]; goto -> bb14;
} }
bb9: { bb9: {
goto -> bb11; drop(_7) -> [return: bb11, unwind: bb33];
} }
bb10: { bb10: {
StorageDead(_7); goto -> bb12;
StorageDead(_6);
goto -> bb16;
} }
bb11: { bb11: {
drop(_7) -> [return: bb12, unwind: bb31]; StorageDead(_7);
StorageDead(_6);
goto -> bb17;
} }
bb12: { bb12: {
StorageDead(_7); drop(_7) -> [return: bb13, unwind: bb33];
StorageDead(_6);
goto -> bb13;
} }
bb13: { bb13: {
StorageDead(_7);
StorageDead(_6);
goto -> bb14;
}
bb14: {
StorageLive(_8); StorageLive(_8);
StorageLive(_9); StorageLive(_9);
StorageLive(_10); StorageLive(_10);
_10 = Droppy(const 1_u8); _10 = Droppy(const 1_u8);
_9 = (_10.0: u8); _9 = (_10.0: u8);
_8 = Gt(move _9, const 1_u8); _8 = Gt(move _9, const 1_u8);
switchInt(move _8) -> [0: bb15, otherwise: bb14]; switchInt(move _8) -> [0: bb16, otherwise: bb15];
}
bb14: {
drop(_10) -> [return: bb16, unwind: bb31];
} }
bb15: { bb15: {
goto -> bb17; drop(_10) -> [return: bb17, unwind: bb33];
} }
bb16: { bb16: {
StorageDead(_10); goto -> bb18;
StorageDead(_9);
_1 = const ();
goto -> bb20;
} }
bb17: { bb17: {
drop(_10) -> [return: bb18, unwind: bb31]; StorageDead(_10);
StorageDead(_9);
_1 = const ();
goto -> bb21;
} }
bb18: { bb18: {
StorageDead(_10); drop(_10) -> [return: bb19, unwind: bb33];
StorageDead(_9);
goto -> bb19;
} }
bb19: { bb19: {
_1 = const (); StorageDead(_10);
StorageDead(_9);
goto -> bb20; goto -> bb20;
} }
bb20: { bb20: {
_1 = const ();
goto -> bb21;
}
bb21: {
StorageDead(_8); StorageDead(_8);
StorageDead(_5); StorageDead(_5);
StorageDead(_4); StorageDead(_4);
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
StorageLive(_11); StorageLive(_11);
_11 = always_true() -> [return: bb21, unwind: bb31]; _11 = always_true() -> [return: bb22, unwind: bb33];
}
bb21: {
switchInt(move _11) -> [0: bb23, otherwise: bb22];
} }
bb22: { bb22: {
goto -> bb29; switchInt(move _11) -> [0: bb24, otherwise: bb23];
} }
bb23: { bb23: {
goto -> bb24; goto -> bb31;
} }
bb24: { bb24: {
StorageLive(_12); goto -> bb25;
_12 = E::f() -> [return: bb25, unwind: bb31];
} }
bb25: { bb25: {
PlaceMention(_12); StorageLive(_12);
_13 = discriminant(_12); _12 = E::f() -> [return: bb26, unwind: bb33];
switchInt(move _13) -> [1: bb27, otherwise: bb26];
} }
bb26: { bb26: {
goto -> bb29; PlaceMention(_12);
_13 = discriminant(_12);
switchInt(move _13) -> [1: bb29, otherwise: bb28];
} }
bb27: { bb27: {
falseEdge -> [real: bb28, imaginary: bb26]; FakeRead(ForMatchedPlace(None), _12);
unreachable;
} }
bb28: { bb28: {
_0 = const (); goto -> bb31;
goto -> bb30;
} }
bb29: { bb29: {
_0 = const (); falseEdge -> [real: bb30, imaginary: bb28];
goto -> bb30;
} }
bb30: { bb30: {
_0 = const ();
goto -> bb32;
}
bb31: {
_0 = const ();
goto -> bb32;
}
bb32: {
StorageDead(_11); StorageDead(_11);
StorageDead(_12); StorageDead(_12);
return; return;
} }
bb31 (cleanup): { bb33 (cleanup): {
resume; resume;
} }
} }

View file

@ -28,25 +28,25 @@ fn full_tested_match() -> () {
_2 = Option::<i32>::Some(const 42_i32); _2 = Option::<i32>::Some(const 42_i32);
PlaceMention(_2); PlaceMention(_2);
_3 = discriminant(_2); _3 = discriminant(_2);
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
bb2: {
_1 = (const 3_i32, const 3_i32); _1 = (const 3_i32, const 3_i32);
goto -> bb11; goto -> bb11;
} }
bb2: {
falseEdge -> [real: bb5, imaginary: bb3];
}
bb3: { bb3: {
falseEdge -> [real: bb10, imaginary: bb1]; falseEdge -> [real: bb5, imaginary: bb4];
} }
bb4: { bb4: {
FakeRead(ForMatchedPlace(None), _2); falseEdge -> [real: bb10, imaginary: bb2];
unreachable;
} }
bb5: { bb5: {
@ -54,7 +54,7 @@ fn full_tested_match() -> () {
_6 = &((_2 as Some).0: i32); _6 = &((_2 as Some).0: i32);
_4 = &fake _2; _4 = &fake _2;
StorageLive(_7); StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12]; _7 = guard() -> [return: bb6, unwind: bb13];
} }
bb6: { bb6: {
@ -83,7 +83,7 @@ fn full_tested_match() -> () {
bb9: { bb9: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
goto -> bb3; goto -> bb4;
} }
bb10: { bb10: {
@ -105,7 +105,12 @@ fn full_tested_match() -> () {
return; return;
} }
bb12 (cleanup): { bb12: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb13 (cleanup): {
resume; resume;
} }
} }

View file

@ -28,18 +28,23 @@ fn full_tested_match2() -> () {
_2 = Option::<i32>::Some(const 42_i32); _2 = Option::<i32>::Some(const 42_i32);
PlaceMention(_2); PlaceMention(_2);
_3 = discriminant(_2); _3 = discriminant(_2);
switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
falseEdge -> [real: bb10, imaginary: bb3]; FakeRead(ForMatchedPlace(None), _2);
unreachable;
} }
bb2: { bb2: {
falseEdge -> [real: bb5, imaginary: bb1]; falseEdge -> [real: bb10, imaginary: bb4];
} }
bb3: { bb3: {
falseEdge -> [real: bb5, imaginary: bb2];
}
bb4: {
StorageLive(_9); StorageLive(_9);
_9 = ((_2 as Some).0: i32); _9 = ((_2 as Some).0: i32);
StorageLive(_10); StorageLive(_10);
@ -50,17 +55,12 @@ fn full_tested_match2() -> () {
goto -> bb11; goto -> bb11;
} }
bb4: {
FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
bb5: { bb5: {
StorageLive(_6); StorageLive(_6);
_6 = &((_2 as Some).0: i32); _6 = &((_2 as Some).0: i32);
_4 = &fake _2; _4 = &fake _2;
StorageLive(_7); StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12]; _7 = guard() -> [return: bb6, unwind: bb13];
} }
bb6: { bb6: {
@ -89,7 +89,7 @@ fn full_tested_match2() -> () {
bb9: { bb9: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
falseEdge -> [real: bb3, imaginary: bb1]; falseEdge -> [real: bb4, imaginary: bb2];
} }
bb10: { bb10: {
@ -105,7 +105,12 @@ fn full_tested_match2() -> () {
return; return;
} }
bb12 (cleanup): { bb12: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb13 (cleanup): {
resume; resume;
} }
} }

View file

@ -39,55 +39,60 @@ fn main() -> () {
_2 = Option::<i32>::Some(const 1_i32); _2 = Option::<i32>::Some(const 1_i32);
PlaceMention(_2); PlaceMention(_2);
_4 = discriminant(_2); _4 = discriminant(_2);
switchInt(move _4) -> [1: bb2, otherwise: bb1]; switchInt(move _4) -> [1: bb7, otherwise: bb2];
} }
bb1: { bb1: {
falseEdge -> [real: bb13, imaginary: bb6]; FakeRead(ForMatchedPlace(None), _2);
unreachable;
} }
bb2: { bb2: {
falseEdge -> [real: bb8, imaginary: bb1]; falseEdge -> [real: bb14, imaginary: bb5];
} }
bb3: { bb3: {
goto -> bb1; _3 = discriminant(_2);
switchInt(move _3) -> [1: bb5, otherwise: bb4];
} }
bb4: { bb4: {
_3 = discriminant(_2);
switchInt(move _3) -> [1: bb6, otherwise: bb5];
}
bb5: {
StorageLive(_14); StorageLive(_14);
_14 = _2; _14 = _2;
_1 = const 4_i32; _1 = const 4_i32;
StorageDead(_14); StorageDead(_14);
goto -> bb19; goto -> bb20;
}
bb5: {
falseEdge -> [real: bb15, imaginary: bb4];
} }
bb6: { bb6: {
falseEdge -> [real: bb14, imaginary: bb5]; goto -> bb4;
} }
bb7: { bb7: {
goto -> bb5; falseEdge -> [real: bb9, imaginary: bb2];
} }
bb8: { bb8: {
goto -> bb2;
}
bb9: {
StorageLive(_7); StorageLive(_7);
_7 = &((_2 as Some).0: i32); _7 = &((_2 as Some).0: i32);
_5 = &fake _2; _5 = &fake _2;
StorageLive(_8); StorageLive(_8);
_8 = guard() -> [return: bb9, unwind: bb20]; _8 = guard() -> [return: bb10, unwind: bb22];
}
bb9: {
switchInt(move _8) -> [0: bb11, otherwise: bb10];
} }
bb10: { bb10: {
switchInt(move _8) -> [0: bb12, otherwise: bb11];
}
bb11: {
StorageDead(_8); StorageDead(_8);
FakeRead(ForMatchGuard, _5); FakeRead(ForMatchGuard, _5);
FakeRead(ForGuardBinding, _7); FakeRead(ForGuardBinding, _7);
@ -96,42 +101,42 @@ fn main() -> () {
_1 = const 1_i32; _1 = const 1_i32;
StorageDead(_6); StorageDead(_6);
StorageDead(_7); StorageDead(_7);
goto -> bb19; goto -> bb20;
}
bb11: {
goto -> bb12;
} }
bb12: { bb12: {
StorageDead(_8); goto -> bb13;
StorageDead(_7);
falseEdge -> [real: bb3, imaginary: bb1];
} }
bb13: { bb13: {
StorageDead(_8);
StorageDead(_7);
falseEdge -> [real: bb8, imaginary: bb2];
}
bb14: {
StorageLive(_9); StorageLive(_9);
_9 = _2; _9 = _2;
_1 = const 2_i32; _1 = const 2_i32;
StorageDead(_9); StorageDead(_9);
goto -> bb19; goto -> bb20;
} }
bb14: { bb15: {
StorageLive(_11); StorageLive(_11);
_11 = &((_2 as Some).0: i32); _11 = &((_2 as Some).0: i32);
_5 = &fake _2; _5 = &fake _2;
StorageLive(_12); StorageLive(_12);
StorageLive(_13); StorageLive(_13);
_13 = (*_11); _13 = (*_11);
_12 = guard2(move _13) -> [return: bb15, unwind: bb20]; _12 = guard2(move _13) -> [return: bb16, unwind: bb22];
}
bb15: {
switchInt(move _12) -> [0: bb17, otherwise: bb16];
} }
bb16: { bb16: {
switchInt(move _12) -> [0: bb18, otherwise: bb17];
}
bb17: {
StorageDead(_13); StorageDead(_13);
StorageDead(_12); StorageDead(_12);
FakeRead(ForMatchGuard, _5); FakeRead(ForMatchGuard, _5);
@ -141,21 +146,21 @@ fn main() -> () {
_1 = const 3_i32; _1 = const 3_i32;
StorageDead(_10); StorageDead(_10);
StorageDead(_11); StorageDead(_11);
goto -> bb19; goto -> bb20;
}
bb17: {
goto -> bb18;
} }
bb18: { bb18: {
StorageDead(_13); goto -> bb19;
StorageDead(_12);
StorageDead(_11);
falseEdge -> [real: bb7, imaginary: bb5];
} }
bb19: { bb19: {
StorageDead(_13);
StorageDead(_12);
StorageDead(_11);
falseEdge -> [real: bb6, imaginary: bb4];
}
bb20: {
PlaceMention(_1); PlaceMention(_1);
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
@ -163,7 +168,12 @@ fn main() -> () {
return; return;
} }
bb20 (cleanup): { bb21: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb22 (cleanup): {
resume; resume;
} }
} }

View file

@ -6,24 +6,29 @@ fn match_bool(_1: bool) -> usize {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
switchInt(_1) -> [0: bb2, otherwise: bb1]; switchInt(_1) -> [0: bb2, otherwise: bb3];
} }
bb1: { bb1: {
falseEdge -> [real: bb3, imaginary: bb2]; FakeRead(ForMatchedPlace(None), _1);
unreachable;
} }
bb2: { bb2: {
_0 = const 20_usize; _0 = const 20_usize;
goto -> bb4; goto -> bb5;
} }
bb3: { bb3: {
_0 = const 10_usize; falseEdge -> [real: bb4, imaginary: bb2];
goto -> bb4;
} }
bb4: { bb4: {
_0 = const 10_usize;
goto -> bb5;
}
bb5: {
return; return;
} }
} }

View file

@ -30,7 +30,7 @@ fn move_out_by_subslice() -> () {
StorageLive(_2); StorageLive(_2);
_3 = SizeOf(i32); _3 = SizeOf(i32);
_4 = AlignOf(i32); _4 = AlignOf(i32);
_5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13];
} }
bb1: { bb1: {
@ -38,7 +38,7 @@ fn move_out_by_subslice() -> () {
_6 = ShallowInitBox(move _5, i32); _6 = ShallowInitBox(move _5, i32);
(*_6) = const 1_i32; (*_6) = const 1_i32;
_2 = move _6; _2 = move _6;
drop(_6) -> [return: bb2, unwind: bb11]; drop(_6) -> [return: bb2, unwind: bb12];
} }
bb2: { bb2: {
@ -46,7 +46,7 @@ fn move_out_by_subslice() -> () {
StorageLive(_7); StorageLive(_7);
_8 = SizeOf(i32); _8 = SizeOf(i32);
_9 = AlignOf(i32); _9 = AlignOf(i32);
_10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12];
} }
bb3: { bb3: {
@ -54,18 +54,18 @@ fn move_out_by_subslice() -> () {
_11 = ShallowInitBox(move _10, i32); _11 = ShallowInitBox(move _10, i32);
(*_11) = const 2_i32; (*_11) = const 2_i32;
_7 = move _11; _7 = move _11;
drop(_11) -> [return: bb4, unwind: bb10]; drop(_11) -> [return: bb4, unwind: bb11];
} }
bb4: { bb4: {
StorageDead(_11); StorageDead(_11);
_1 = [move _2, move _7]; _1 = [move _2, move _7];
drop(_7) -> [return: bb5, unwind: bb11]; drop(_7) -> [return: bb5, unwind: bb12];
} }
bb5: { bb5: {
StorageDead(_7); StorageDead(_7);
drop(_2) -> [return: bb6, unwind: bb12]; drop(_2) -> [return: bb6, unwind: bb13];
} }
bb6: { bb6: {
@ -75,32 +75,37 @@ fn move_out_by_subslice() -> () {
StorageLive(_12); StorageLive(_12);
_12 = move _1[0..2]; _12 = move _1[0..2];
_0 = const (); _0 = const ();
drop(_12) -> [return: bb7, unwind: bb9]; drop(_12) -> [return: bb8, unwind: bb10];
} }
bb7: { bb7: {
StorageDead(_12); FakeRead(ForMatchedPlace(None), _1);
drop(_1) -> [return: bb8, unwind: bb12]; unreachable;
} }
bb8: { bb8: {
StorageDead(_12);
drop(_1) -> [return: bb9, unwind: bb13];
}
bb9: {
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb9 (cleanup): {
drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): { bb10 (cleanup): {
drop(_7) -> [return: bb11, unwind terminate(cleanup)]; drop(_1) -> [return: bb13, unwind terminate(cleanup)];
} }
bb11 (cleanup): { bb11 (cleanup): {
drop(_2) -> [return: bb12, unwind terminate(cleanup)]; drop(_7) -> [return: bb12, unwind terminate(cleanup)];
} }
bb12 (cleanup): { bb12 (cleanup): {
drop(_2) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
resume; resume;
} }
} }

View file

@ -30,7 +30,7 @@ fn move_out_from_end() -> () {
StorageLive(_2); StorageLive(_2);
_3 = SizeOf(i32); _3 = SizeOf(i32);
_4 = AlignOf(i32); _4 = AlignOf(i32);
_5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13];
} }
bb1: { bb1: {
@ -38,7 +38,7 @@ fn move_out_from_end() -> () {
_6 = ShallowInitBox(move _5, i32); _6 = ShallowInitBox(move _5, i32);
(*_6) = const 1_i32; (*_6) = const 1_i32;
_2 = move _6; _2 = move _6;
drop(_6) -> [return: bb2, unwind: bb11]; drop(_6) -> [return: bb2, unwind: bb12];
} }
bb2: { bb2: {
@ -46,7 +46,7 @@ fn move_out_from_end() -> () {
StorageLive(_7); StorageLive(_7);
_8 = SizeOf(i32); _8 = SizeOf(i32);
_9 = AlignOf(i32); _9 = AlignOf(i32);
_10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12];
} }
bb3: { bb3: {
@ -54,18 +54,18 @@ fn move_out_from_end() -> () {
_11 = ShallowInitBox(move _10, i32); _11 = ShallowInitBox(move _10, i32);
(*_11) = const 2_i32; (*_11) = const 2_i32;
_7 = move _11; _7 = move _11;
drop(_11) -> [return: bb4, unwind: bb10]; drop(_11) -> [return: bb4, unwind: bb11];
} }
bb4: { bb4: {
StorageDead(_11); StorageDead(_11);
_1 = [move _2, move _7]; _1 = [move _2, move _7];
drop(_7) -> [return: bb5, unwind: bb11]; drop(_7) -> [return: bb5, unwind: bb12];
} }
bb5: { bb5: {
StorageDead(_7); StorageDead(_7);
drop(_2) -> [return: bb6, unwind: bb12]; drop(_2) -> [return: bb6, unwind: bb13];
} }
bb6: { bb6: {
@ -75,32 +75,37 @@ fn move_out_from_end() -> () {
StorageLive(_12); StorageLive(_12);
_12 = move _1[1 of 2]; _12 = move _1[1 of 2];
_0 = const (); _0 = const ();
drop(_12) -> [return: bb7, unwind: bb9]; drop(_12) -> [return: bb8, unwind: bb10];
} }
bb7: { bb7: {
StorageDead(_12); FakeRead(ForMatchedPlace(None), _1);
drop(_1) -> [return: bb8, unwind: bb12]; unreachable;
} }
bb8: { bb8: {
StorageDead(_12);
drop(_1) -> [return: bb9, unwind: bb13];
}
bb9: {
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb9 (cleanup): {
drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): { bb10 (cleanup): {
drop(_7) -> [return: bb11, unwind terminate(cleanup)]; drop(_1) -> [return: bb13, unwind terminate(cleanup)];
} }
bb11 (cleanup): { bb11 (cleanup): {
drop(_2) -> [return: bb12, unwind terminate(cleanup)]; drop(_7) -> [return: bb12, unwind terminate(cleanup)];
} }
bb12 (cleanup): { bb12 (cleanup): {
drop(_2) -> [return: bb13, unwind terminate(cleanup)];
}
bb13 (cleanup): {
resume; resume;
} }
} }

View file

@ -79,10 +79,14 @@
bb4: { bb4: {
StorageDead(_12); StorageDead(_12);
_14 = discriminant(_11); _14 = discriminant(_11);
switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; switchInt(move _14) -> [0: bb7, 1: bb6, otherwise: bb5];
} }
bb5: { bb5: {
unreachable;
}
bb6: {
- StorageLive(_16); - StorageLive(_16);
_16 = ((_11 as Some).0: usize); _16 = ((_11 as Some).0: usize);
StorageLive(_17); StorageLive(_17);
@ -95,10 +99,6 @@
+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable]; + assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable];
} }
bb6: {
unreachable;
}
bb7: { bb7: {
_0 = const (); _0 = const ();
StorageDead(_13); StorageDead(_13);

View file

@ -79,10 +79,14 @@
bb4: { bb4: {
StorageDead(_12); StorageDead(_12);
_14 = discriminant(_11); _14 = discriminant(_11);
switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; switchInt(move _14) -> [0: bb7, 1: bb6, otherwise: bb5];
} }
bb5: { bb5: {
unreachable;
}
bb6: {
- StorageLive(_16); - StorageLive(_16);
_16 = ((_11 as Some).0: usize); _16 = ((_11 as Some).0: usize);
StorageLive(_17); StorageLive(_17);
@ -95,10 +99,6 @@
+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind continue]; + assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind continue];
} }
bb6: {
unreachable;
}
bb7: { bb7: {
_0 = const (); _0 = const ();
StorageDead(_13); StorageDead(_13);

View file

@ -26,12 +26,16 @@
_1 = const _; _1 = const _;
StorageLive(_2); StorageLive(_2);
- _3 = discriminant(_1); - _3 = discriminant(_1);
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; - switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
+ _3 = const 0_isize; + _3 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = ((_1 as V2).0: i32); _5 = ((_1 as V2).0: i32);
_2 = _5; _2 = _5;
@ -39,10 +43,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_4); StorageLive(_4);
- _4 = ((_1 as V1).0: i32); - _4 = ((_1 as V1).0: i32);

View file

@ -26,12 +26,16 @@
_1 = const _; _1 = const _;
StorageLive(_2); StorageLive(_2);
- _3 = discriminant(_1); - _3 = discriminant(_1);
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; - switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
+ _3 = const 0_isize; + _3 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = ((_1 as V2).0: i32); _5 = ((_1 as V2).0: i32);
_2 = _5; _2 = _5;
@ -39,10 +43,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_4); StorageLive(_4);
- _4 = ((_1 as V1).0: i32); - _4 = ((_1 as V1).0: i32);

View file

@ -49,16 +49,16 @@
StorageDead(_4); StorageDead(_4);
StorageLive(_6); StorageLive(_6);
_7 = discriminant(_3); _7 = discriminant(_3);
switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; switchInt(move _7) -> [0: bb5, 1: bb6, otherwise: bb4];
} }
bb4: { bb4: {
_6 = const 0_u8; unreachable;
goto -> bb7;
} }
bb5: { bb5: {
unreachable; _6 = const 0_u8;
goto -> bb7;
} }
bb6: { bb6: {

View file

@ -49,16 +49,16 @@
StorageDead(_4); StorageDead(_4);
StorageLive(_6); StorageLive(_6);
_7 = discriminant(_3); _7 = discriminant(_3);
switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; switchInt(move _7) -> [0: bb5, 1: bb6, otherwise: bb4];
} }
bb4: { bb4: {
_6 = const 0_u8; unreachable;
goto -> bb7;
} }
bb5: { bb5: {
unreachable; _6 = const 0_u8;
goto -> bb7;
} }
bb6: { bb6: {

View file

@ -20,7 +20,7 @@ fn simple() {
// CHECK: [[e]] = const E::V1(0_i32); // CHECK: [[e]] = const E::V1(0_i32);
let e = E::V1(0); let e = E::V1(0);
// CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb1, otherwise: bb2]; // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb2, otherwise: bb1];
// CHECK: [[target_bb]]: { // CHECK: [[target_bb]]: {
// CHECK: [[x]] = const 0_i32; // CHECK: [[x]] = const 0_i32;
let x = match e { E::V1(x1) => x1, E::V2(x2) => x2 }; let x = match e { E::V1(x1) => x1, E::V2(x2) => x2 };
@ -36,7 +36,7 @@ fn constant() {
// CHECK: [[e]] = const _; // CHECK: [[e]] = const _;
let e = C; let e = C;
// CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb1, otherwise: bb2]; // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb2, otherwise: bb1];
// CHECK: [[target_bb]]: { // CHECK: [[target_bb]]: {
// CHECK: [[x]] = const 0_i32; // CHECK: [[x]] = const 0_i32;
let x = match e { E::V1(x1) => x1, E::V2(x2) => x2 }; let x = match e { E::V1(x1) => x1, E::V2(x2) => x2 };
@ -55,7 +55,7 @@ fn statics() {
// CHECK: [[e1]] = const E::V1(0_i32); // CHECK: [[e1]] = const E::V1(0_i32);
let e1 = C; let e1 = C;
// CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb1, otherwise: bb2]; // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb2, otherwise: bb1];
// CHECK: [[target_bb]]: { // CHECK: [[target_bb]]: {
// CHECK: [[x1]] = const 0_i32; // CHECK: [[x1]] = const 0_i32;
let x1 = match e1 { E::V1(x11) => x11, E::V2(x12) => x12 }; let x1 = match e1 { E::V1(x11) => x11, E::V2(x12) => x12 };

View file

@ -27,12 +27,16 @@
+ _1 = const E::V1(0_i32); + _1 = const E::V1(0_i32);
StorageLive(_2); StorageLive(_2);
- _3 = discriminant(_1); - _3 = discriminant(_1);
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; - switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
+ _3 = const 0_isize; + _3 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = ((_1 as V2).0: i32); _5 = ((_1 as V2).0: i32);
_2 = _5; _2 = _5;
@ -40,10 +44,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_4); StorageLive(_4);
- _4 = ((_1 as V1).0: i32); - _4 = ((_1 as V1).0: i32);

View file

@ -27,12 +27,16 @@
+ _1 = const E::V1(0_i32); + _1 = const E::V1(0_i32);
StorageLive(_2); StorageLive(_2);
- _3 = discriminant(_1); - _3 = discriminant(_1);
- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; - switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
+ _3 = const 0_isize; + _3 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = ((_1 as V2).0: i32); _5 = ((_1 as V2).0: i32);
_2 = _5; _2 = _5;
@ -40,10 +44,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_4); StorageLive(_4);
- _4 = ((_1 as V1).0: i32); - _4 = ((_1 as V1).0: i32);

View file

@ -49,12 +49,16 @@
StorageDead(_2); StorageDead(_2);
StorageLive(_3); StorageLive(_3);
- _4 = discriminant(_1); - _4 = discriminant(_1);
- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2]; - switchInt(move _4) -> [0: bb3, 1: bb2, otherwise: bb1];
+ _4 = const 0_isize; + _4 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_6); StorageLive(_6);
_6 = ((_1 as V2).0: i32); _6 = ((_1 as V2).0: i32);
_3 = _6; _3 = _6;
@ -62,10 +66,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_5); StorageLive(_5);
- _5 = ((_1 as V1).0: i32); - _5 = ((_1 as V1).0: i32);
@ -84,7 +84,7 @@
StorageDead(_8); StorageDead(_8);
StorageLive(_9); StorageLive(_9);
_10 = discriminant((*_7)); _10 = discriminant((*_7));
switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2]; switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb1];
} }
bb5: { bb5: {

View file

@ -49,12 +49,16 @@
StorageDead(_2); StorageDead(_2);
StorageLive(_3); StorageLive(_3);
- _4 = discriminant(_1); - _4 = discriminant(_1);
- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2]; - switchInt(move _4) -> [0: bb3, 1: bb2, otherwise: bb1];
+ _4 = const 0_isize; + _4 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_6); StorageLive(_6);
_6 = ((_1 as V2).0: i32); _6 = ((_1 as V2).0: i32);
_3 = _6; _3 = _6;
@ -62,10 +66,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_5); StorageLive(_5);
- _5 = ((_1 as V1).0: i32); - _5 = ((_1 as V1).0: i32);
@ -84,7 +84,7 @@
StorageDead(_8); StorageDead(_8);
StorageLive(_9); StorageLive(_9);
_10 = discriminant((*_7)); _10 = discriminant((*_7));
switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2]; switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb1];
} }
bb5: { bb5: {

View file

@ -25,58 +25,66 @@
_7 = Len((*_2)); _7 = Len((*_2));
_8 = const 4_usize; _8 = const 4_usize;
_9 = Ge(move _7, move _8); _9 = Ge(move _7, move _8);
switchInt(move _9) -> [0: bb6, otherwise: bb2]; - switchInt(move _9) -> [0: bb2, otherwise: bb7];
+ switchInt(move _9) -> [0: bb2, otherwise: bb6];
} }
bb2: { bb2: {
switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6];
}
bb3: {
switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6];
}
bb4: {
switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6];
}
bb5: {
- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6];
+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6];
}
bb6: {
_4 = Len((*_2)); _4 = Len((*_2));
_5 = const 3_usize; _5 = const 3_usize;
_6 = Ge(move _4, move _5); _6 = Ge(move _4, move _5);
switchInt(move _6) -> [0: bb10, otherwise: bb7]; - switchInt(move _6) -> [0: bb3, otherwise: bb4];
+ switchInt(move _6) -> [0: bb10, otherwise: bb3];
} }
bb7: { bb3: {
switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; - _0 = const false;
- goto -> bb14;
+ switchInt((*_2)[0 of 3]) -> [47: bb4, otherwise: bb10];
} }
bb8: { bb4: {
switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; - switchInt((*_2)[0 of 3]) -> [47: bb5, otherwise: bb3];
+ switchInt((*_2)[1 of 3]) -> [47: bb5, otherwise: bb10];
} }
bb9: { bb5: {
- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; - switchInt((*_2)[1 of 3]) -> [47: bb6, otherwise: bb3];
+ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; + switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10];
} }
bb6: {
- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb3];
+ switchInt((*_2)[0 of 4]) -> [47: bb7, otherwise: bb2];
}
bb7: {
- switchInt((*_2)[0 of 4]) -> [47: bb8, otherwise: bb2];
+ switchInt((*_2)[1 of 4]) -> [47: bb8, otherwise: bb2];
}
bb8: {
- switchInt((*_2)[1 of 4]) -> [47: bb9, otherwise: bb2];
+ switchInt((*_2)[2 of 4]) -> [47: bb9, otherwise: bb2];
}
bb9: {
- switchInt((*_2)[2 of 4]) -> [47: bb10, otherwise: bb2];
+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb2];
}
bb10: { bb10: {
- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb2];
- }
-
- bb11: {
_0 = const false; _0 = const false;
- goto -> bb14; - goto -> bb14;
+ goto -> bb12; + goto -> bb12;
} }
bb11: {
- _0 = const false;
- goto -> bb14;
- }
-
- bb12: { - bb12: {
+ bb11: {
_0 = const true; _0 = const true;
- goto -> bb14; - goto -> bb14;
+ goto -> bb12; + goto -> bb12;

View file

@ -25,58 +25,66 @@
_7 = Len((*_2)); _7 = Len((*_2));
_8 = const 4_usize; _8 = const 4_usize;
_9 = Ge(move _7, move _8); _9 = Ge(move _7, move _8);
switchInt(move _9) -> [0: bb6, otherwise: bb2]; - switchInt(move _9) -> [0: bb2, otherwise: bb7];
+ switchInt(move _9) -> [0: bb2, otherwise: bb6];
} }
bb2: { bb2: {
switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6];
}
bb3: {
switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6];
}
bb4: {
switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6];
}
bb5: {
- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6];
+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6];
}
bb6: {
_4 = Len((*_2)); _4 = Len((*_2));
_5 = const 3_usize; _5 = const 3_usize;
_6 = Ge(move _4, move _5); _6 = Ge(move _4, move _5);
switchInt(move _6) -> [0: bb10, otherwise: bb7]; - switchInt(move _6) -> [0: bb3, otherwise: bb4];
+ switchInt(move _6) -> [0: bb10, otherwise: bb3];
} }
bb7: { bb3: {
switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; - _0 = const false;
- goto -> bb14;
+ switchInt((*_2)[0 of 3]) -> [47: bb4, otherwise: bb10];
} }
bb8: { bb4: {
switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; - switchInt((*_2)[0 of 3]) -> [47: bb5, otherwise: bb3];
+ switchInt((*_2)[1 of 3]) -> [47: bb5, otherwise: bb10];
} }
bb9: { bb5: {
- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; - switchInt((*_2)[1 of 3]) -> [47: bb6, otherwise: bb3];
+ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; + switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10];
} }
bb6: {
- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb3];
+ switchInt((*_2)[0 of 4]) -> [47: bb7, otherwise: bb2];
}
bb7: {
- switchInt((*_2)[0 of 4]) -> [47: bb8, otherwise: bb2];
+ switchInt((*_2)[1 of 4]) -> [47: bb8, otherwise: bb2];
}
bb8: {
- switchInt((*_2)[1 of 4]) -> [47: bb9, otherwise: bb2];
+ switchInt((*_2)[2 of 4]) -> [47: bb9, otherwise: bb2];
}
bb9: {
- switchInt((*_2)[2 of 4]) -> [47: bb10, otherwise: bb2];
+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb2];
}
bb10: { bb10: {
- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb2];
- }
-
- bb11: {
_0 = const false; _0 = const false;
- goto -> bb14; - goto -> bb14;
+ goto -> bb12; + goto -> bb12;
} }
bb11: {
- _0 = const false;
- goto -> bb14;
- }
-
- bb12: { - bb12: {
+ bb11: {
_0 = const true; _0 = const true;
- goto -> bb14; - goto -> bb14;
+ goto -> bb12; + goto -> bb12;

View file

@ -55,10 +55,14 @@
StorageDead(_8); StorageDead(_8);
PlaceMention(_7); PlaceMention(_7);
_10 = discriminant(_7); _10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4];
} }
bb4: { bb4: {
unreachable;
}
bb5: {
StorageLive(_12); StorageLive(_12);
- _12 = (*((_7 as Some).0: &i32)); - _12 = (*((_7 as Some).0: &i32));
+ _15 = deref_copy ((_7 as Some).0: &i32); + _15 = deref_copy ((_7 as Some).0: &i32);
@ -68,10 +72,6 @@
_6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind: bb8]; _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind: bb8];
} }
bb5: {
unreachable;
}
bb6: { bb6: {
_0 = const (); _0 = const ();
StorageDead(_9); StorageDead(_9);

View file

@ -55,10 +55,14 @@
StorageDead(_8); StorageDead(_8);
PlaceMention(_7); PlaceMention(_7);
_10 = discriminant(_7); _10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4];
} }
bb4: { bb4: {
unreachable;
}
bb5: {
StorageLive(_12); StorageLive(_12);
- _12 = (*((_7 as Some).0: &i32)); - _12 = (*((_7 as Some).0: &i32));
+ _15 = deref_copy ((_7 as Some).0: &i32); + _15 = deref_copy ((_7 as Some).0: &i32);
@ -68,10 +72,6 @@
_6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind continue]; _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind continue];
} }
bb5: {
unreachable;
}
bb6: { bb6: {
_0 = const (); _0 = const ();
StorageDead(_9); StorageDead(_9);

View file

@ -30,7 +30,7 @@
StorageDead(_5); StorageDead(_5);
StorageDead(_4); StorageDead(_4);
_8 = discriminant((_3.0: std::option::Option<u32>)); _8 = discriminant((_3.0: std::option::Option<u32>));
- switchInt(move _8) -> [0: bb1, 1: bb3, otherwise: bb2]; - switchInt(move _8) -> [0: bb2, 1: bb3, otherwise: bb1];
+ StorageLive(_11); + StorageLive(_11);
+ _11 = discriminant((_3.1: std::option::Option<u32>)); + _11 = discriminant((_3.1: std::option::Option<u32>));
+ StorageLive(_12); + StorageLive(_12);
@ -40,24 +40,23 @@
} }
bb1: { bb1: {
- _6 = discriminant((_3.1: std::option::Option<u32>));
- switchInt(move _6) -> [0: bb5, otherwise: bb2];
- }
-
- bb2: {
+ StorageDead(_12); + StorageDead(_12);
_0 = const 1_u32; _0 = const 1_u32;
- goto -> bb6; - goto -> bb6;
+ goto -> bb4; + goto -> bb4;
} }
bb2: {
- _6 = discriminant((_3.1: std::option::Option<u32>));
- switchInt(move _6) -> [0: bb5, otherwise: bb1];
- }
-
- bb3: { - bb3: {
- _7 = discriminant((_3.1: std::option::Option<u32>)); - _7 = discriminant((_3.1: std::option::Option<u32>));
- switchInt(move _7) -> [1: bb4, otherwise: bb2]; - switchInt(move _7) -> [1: bb4, otherwise: bb1];
- } - }
- -
- bb4: { - bb4: {
+ bb2: {
StorageLive(_10); StorageLive(_10);
_10 = (((_3.1: std::option::Option<u32>) as Some).0: u32); _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32);
StorageLive(_9); StorageLive(_9);

View file

@ -78,16 +78,10 @@
StorageDead(_5); StorageDead(_5);
_34 = deref_copy (_4.0: &ViewportPercentageLength); _34 = deref_copy (_4.0: &ViewportPercentageLength);
_11 = discriminant((*_34)); _11 = discriminant((*_34));
switchInt(move _11) -> [0: bb1, 1: bb3, 2: bb4, 3: bb5, otherwise: bb2]; switchInt(move _11) -> [0: bb2, 1: bb3, 2: bb4, 3: bb5, otherwise: bb1];
} }
bb1: { bb1: {
_35 = deref_copy (_4.1: &ViewportPercentageLength);
_7 = discriminant((*_35));
switchInt(move _7) -> [0: bb6, otherwise: bb2];
}
bb2: {
StorageLive(_33); StorageLive(_33);
_33 = (); _33 = ();
_0 = Result::<ViewportPercentageLength, ()>::Err(move _33); _0 = Result::<ViewportPercentageLength, ()>::Err(move _33);
@ -97,22 +91,28 @@
goto -> bb11; goto -> bb11;
} }
bb2: {
_35 = deref_copy (_4.1: &ViewportPercentageLength);
_7 = discriminant((*_35));
switchInt(move _7) -> [0: bb6, otherwise: bb1];
}
bb3: { bb3: {
_36 = deref_copy (_4.1: &ViewportPercentageLength); _36 = deref_copy (_4.1: &ViewportPercentageLength);
_8 = discriminant((*_36)); _8 = discriminant((*_36));
switchInt(move _8) -> [1: bb7, otherwise: bb2]; switchInt(move _8) -> [1: bb7, otherwise: bb1];
} }
bb4: { bb4: {
_37 = deref_copy (_4.1: &ViewportPercentageLength); _37 = deref_copy (_4.1: &ViewportPercentageLength);
_9 = discriminant((*_37)); _9 = discriminant((*_37));
switchInt(move _9) -> [2: bb8, otherwise: bb2]; switchInt(move _9) -> [2: bb8, otherwise: bb1];
} }
bb5: { bb5: {
_38 = deref_copy (_4.1: &ViewportPercentageLength); _38 = deref_copy (_4.1: &ViewportPercentageLength);
_10 = discriminant((*_38)); _10 = discriminant((*_38));
switchInt(move _10) -> [3: bb9, otherwise: bb2]; switchInt(move _10) -> [3: bb9, otherwise: bb1];
} }
bb6: { bb6: {

View file

@ -36,26 +36,26 @@
StorageDead(_5); StorageDead(_5);
StorageDead(_4); StorageDead(_4);
_8 = discriminant((_3.0: std::option::Option<u32>)); _8 = discriminant((_3.0: std::option::Option<u32>));
switchInt(move _8) -> [0: bb1, 1: bb4, otherwise: bb3]; switchInt(move _8) -> [0: bb2, 1: bb4, otherwise: bb1];
} }
bb1: { bb1: {
_6 = discriminant((_3.1: std::option::Option<u32>)); unreachable;
switchInt(move _6) -> [0: bb2, 1: bb7, otherwise: bb3];
} }
bb2: { bb2: {
_6 = discriminant((_3.1: std::option::Option<u32>));
switchInt(move _6) -> [0: bb3, 1: bb7, otherwise: bb1];
}
bb3: {
_0 = const 3_u32; _0 = const 3_u32;
goto -> bb8; goto -> bb8;
} }
bb3: {
unreachable;
}
bb4: { bb4: {
_7 = discriminant((_3.1: std::option::Option<u32>)); _7 = discriminant((_3.1: std::option::Option<u32>));
switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb3]; switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb1];
} }
bb5: { bb5: {

View file

@ -21,18 +21,18 @@
+ _2 = Option::<T>::Some(_1); + _2 = Option::<T>::Some(_1);
StorageDead(_3); StorageDead(_3);
- _4 = discriminant(_2); - _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; - switchInt(move _4) -> [0: bb2, 1: bb3, otherwise: bb1];
+ _4 = const 1_isize; + _4 = const 1_isize;
+ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; + switchInt(const 1_isize) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
StorageLive(_6); unreachable;
_6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
} }
bb2: { bb2: {
unreachable; StorageLive(_6);
_6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
} }
bb3: { bb3: {

View file

@ -21,18 +21,18 @@
+ _2 = Option::<T>::Some(_1); + _2 = Option::<T>::Some(_1);
StorageDead(_3); StorageDead(_3);
- _4 = discriminant(_2); - _4 = discriminant(_2);
- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; - switchInt(move _4) -> [0: bb2, 1: bb3, otherwise: bb1];
+ _4 = const 1_isize; + _4 = const 1_isize;
+ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; + switchInt(const 1_isize) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
StorageLive(_6); unreachable;
_6 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
} }
bb2: { bb2: {
unreachable; StorageLive(_6);
_6 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
} }
bb3: { bb3: {

View file

@ -28,18 +28,18 @@
+ StorageLive(_3); + StorageLive(_3);
+ StorageLive(_5); + StorageLive(_5);
+ _3 = discriminant(_2); + _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; + switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
+ StorageLive(_4); + unreachable;
+ _4 = cfg!(debug_assertions);
+ assume(_4);
+ _5 = unreachable_unchecked::precondition_check() -> [return: bb2, unwind unreachable];
+ } + }
+ +
+ bb2: { + bb2: {
+ unreachable; + StorageLive(_4);
+ _4 = cfg!(debug_assertions);
+ assume(_4);
+ _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable];
+ } + }
+ +
+ bb3: { + bb3: {

View file

@ -28,22 +28,22 @@
+ StorageLive(_3); + StorageLive(_3);
+ StorageLive(_5); + StorageLive(_5);
+ _3 = discriminant(_2); + _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; + switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
- StorageDead(_2); - StorageDead(_2);
- return; - return;
+ StorageLive(_4); + unreachable;
+ _4 = cfg!(debug_assertions);
+ assume(_4);
+ _5 = unreachable_unchecked::precondition_check() -> [return: bb2, unwind unreachable];
} }
- bb2 (cleanup): { - bb2 (cleanup): {
- resume; - resume;
+ bb2: { + bb2: {
+ unreachable; + StorageLive(_4);
+ _4 = cfg!(debug_assertions);
+ assume(_4);
+ _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable];
+ } + }
+ +
+ bb3: { + bb3: {

View file

@ -47,10 +47,14 @@ fn test() -> Option<Box<u32>> {
StorageDead(_7); StorageDead(_7);
PlaceMention(_6); PlaceMention(_6);
_8 = discriminant(_6); _8 = discriminant(_6);
switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; switchInt(move _8) -> [0: bb4, 1: bb5, otherwise: bb3];
} }
bb3: { bb3: {
unreachable;
}
bb4: {
StorageLive(_12); StorageLive(_12);
_12 = ((_6 as Continue).0: u32); _12 = ((_6 as Continue).0: u32);
(*_5) = _12; (*_5) = _12;
@ -59,10 +63,6 @@ fn test() -> Option<Box<u32>> {
drop(_5) -> [return: bb7, unwind: bb11]; drop(_5) -> [return: bb7, unwind: bb11];
} }
bb4: {
unreachable;
}
bb5: { bb5: {
StorageLive(_9); StorageLive(_9);
_9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>);

View file

@ -47,10 +47,14 @@ fn test() -> Option<Box<u32>> {
StorageDead(_7); StorageDead(_7);
PlaceMention(_6); PlaceMention(_6);
_8 = discriminant(_6); _8 = discriminant(_6);
switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; switchInt(move _8) -> [0: bb4, 1: bb5, otherwise: bb3];
} }
bb3: { bb3: {
unreachable;
}
bb4: {
StorageLive(_12); StorageLive(_12);
_12 = ((_6 as Continue).0: u32); _12 = ((_6 as Continue).0: u32);
(*_5) = _12; (*_5) = _12;
@ -59,10 +63,6 @@ fn test() -> Option<Box<u32>> {
drop(_5) -> [return: bb7, unwind: bb11]; drop(_5) -> [return: bb7, unwind: bb11];
} }
bb4: {
unreachable;
}
bb5: { bb5: {
StorageLive(_9); StorageLive(_9);
_9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>);

View file

@ -14,4 +14,9 @@ fn bar(_1: [(Never, u32); 1]) -> u32 {
StorageDead(_2); StorageDead(_2);
return; return;
} }
bb1: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
} }

View file

@ -22,7 +22,7 @@ fn main() -> () {
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
_1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb3]; _1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb5];
} }
bb1: { bb1: {
@ -42,10 +42,15 @@ fn main() -> () {
_6 = const 0_usize; _6 = const 0_usize;
_7 = Len(_2); _7 = Len(_2);
_8 = Lt(_6, _7); _8 = Lt(_6, _7);
assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb2, unwind: bb3]; assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb3, unwind: bb5];
} }
bb2: { bb2: {
FakeRead(ForMatchedPlace(None), _1);
unreachable;
}
bb3: {
_5 = (_2[_6].0: u64); _5 = (_2[_6].0: u64);
PlaceMention(_5); PlaceMention(_5);
StorageDead(_6); StorageDead(_6);
@ -55,7 +60,12 @@ fn main() -> () {
return; return;
} }
bb3 (cleanup): { bb4: {
FakeRead(ForMatchedPlace(None), _5);
unreachable;
}
bb5 (cleanup): {
resume; resume;
} }
} }

View file

@ -6,11 +6,15 @@ fn f(_1: Void) -> ! {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
goto -> bb1;
}
bb1: {
FakeRead(ForMatchedPlace(None), _1); FakeRead(ForMatchedPlace(None), _1);
unreachable; unreachable;
} }
bb1: { bb2: {
return; return;
} }
} }

View file

@ -12,7 +12,7 @@ fn bar(_1: Box<[T]>) -> () {
StorageLive(_2); StorageLive(_2);
StorageLive(_3); StorageLive(_3);
_3 = &(*_1); _3 = &(*_1);
_2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb3]; _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb4];
} }
bb1: { bb1: {
@ -20,18 +20,23 @@ fn bar(_1: Box<[T]>) -> () {
PlaceMention((*_2)); PlaceMention((*_2));
StorageDead(_2); StorageDead(_2);
_0 = const (); _0 = const ();
drop(_1) -> [return: bb2, unwind: bb4]; drop(_1) -> [return: bb3, unwind: bb5];
} }
bb2: { bb2: {
FakeRead(ForMatchedPlace(None), (*_2));
unreachable;
}
bb3: {
return; return;
} }
bb3 (cleanup): { bb4 (cleanup): {
drop(_1) -> [return: bb4, unwind terminate(cleanup)]; drop(_1) -> [return: bb5, unwind terminate(cleanup)];
} }
bb4 (cleanup): { bb5 (cleanup): {
resume; resume;
} }
} }

View file

@ -14,7 +14,7 @@ fn hey(_1: &[T]) -> () {
StorageLive(_3); StorageLive(_3);
StorageLive(_4); StorageLive(_4);
_4 = &(*_1); _4 = &(*_1);
_3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb2]; _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb3];
} }
bb1: { bb1: {
@ -27,7 +27,12 @@ fn hey(_1: &[T]) -> () {
return; return;
} }
bb2 (cleanup): { bb2: {
FakeRead(ForMatchedPlace(None), _2);
unreachable;
}
bb3 (cleanup): {
resume; resume;
} }
} }

View file

@ -67,7 +67,7 @@ fn main() -> () {
StorageLive(_2); StorageLive(_2);
StorageLive(_3); StorageLive(_3);
StorageLive(_4); StorageLive(_4);
_4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21]; _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb23];
} }
bb1: { bb1: {
@ -91,24 +91,29 @@ fn main() -> () {
_11 = &(*_8); _11 = &(*_8);
StorageLive(_12); StorageLive(_12);
_12 = &(*_9); _12 = &(*_9);
_10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21]; _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23];
} }
bb2: { bb2: {
switchInt(move _10) -> [0: bb4, otherwise: bb3]; FakeRead(ForMatchedPlace(None), _2);
unreachable;
} }
bb3: { bb3: {
StorageDead(_12); switchInt(move _10) -> [0: bb5, otherwise: bb4];
StorageDead(_11);
goto -> bb8;
} }
bb4: { bb4: {
goto -> bb5; StorageDead(_12);
StorageDead(_11);
goto -> bb9;
} }
bb5: { bb5: {
goto -> bb6;
}
bb6: {
StorageDead(_12); StorageDead(_12);
StorageDead(_11); StorageDead(_11);
StorageLive(_14); StorageLive(_14);
@ -127,10 +132,10 @@ fn main() -> () {
_19 = &(*_20); _19 = &(*_20);
StorageLive(_21); StorageLive(_21);
_21 = Option::<Arguments<'_>>::None; _21 = Option::<Arguments<'_>>::None;
_15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21; _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb23;
} }
bb6: { bb7: {
StorageDead(_21); StorageDead(_21);
StorageDead(_19); StorageDead(_19);
StorageDead(_17); StorageDead(_17);
@ -142,23 +147,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb7: {
goto -> bb9;
}
bb8: { bb8: {
_1 = const (); goto -> bb10;
goto -> bb9;
} }
bb9: { bb9: {
StorageDead(_10); _1 = const ();
StorageDead(_9);
StorageDead(_8);
goto -> bb10; goto -> bb10;
} }
bb10: { bb10: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb11;
}
bb11: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
@ -168,10 +173,10 @@ fn main() -> () {
StorageLive(_23); StorageLive(_23);
StorageLive(_24); StorageLive(_24);
StorageLive(_25); StorageLive(_25);
_25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21]; _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23];
} }
bb11: { bb12: {
_24 = &_25; _24 = &_25;
StorageLive(_26); StorageLive(_26);
StorageLive(_27); StorageLive(_27);
@ -190,24 +195,29 @@ fn main() -> () {
_31 = &(*_28); _31 = &(*_28);
StorageLive(_32); StorageLive(_32);
_32 = &(*_29); _32 = &(*_29);
_30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21]; _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23];
}
bb12: {
switchInt(move _30) -> [0: bb14, otherwise: bb13];
} }
bb13: { bb13: {
StorageDead(_32); FakeRead(ForMatchedPlace(None), _23);
StorageDead(_31); unreachable;
goto -> bb18;
} }
bb14: { bb14: {
goto -> bb15; switchInt(move _30) -> [0: bb16, otherwise: bb15];
} }
bb15: { bb15: {
StorageDead(_32);
StorageDead(_31);
goto -> bb20;
}
bb16: {
goto -> bb17;
}
bb17: {
StorageDead(_32); StorageDead(_32);
StorageDead(_31); StorageDead(_31);
StorageLive(_34); StorageLive(_34);
@ -226,10 +236,10 @@ fn main() -> () {
_39 = &(*_40); _39 = &(*_40);
StorageLive(_41); StorageLive(_41);
_41 = Option::<Arguments<'_>>::None; _41 = Option::<Arguments<'_>>::None;
_35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21; _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb23;
} }
bb16: { bb18: {
StorageDead(_41); StorageDead(_41);
StorageDead(_39); StorageDead(_39);
StorageDead(_37); StorageDead(_37);
@ -241,23 +251,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb17: {
goto -> bb19;
}
bb18: {
_22 = const ();
goto -> bb19;
}
bb19: { bb19: {
StorageDead(_30); goto -> bb21;
StorageDead(_29);
StorageDead(_28);
goto -> bb20;
} }
bb20: { bb20: {
_22 = const ();
goto -> bb21;
}
bb21: {
StorageDead(_30);
StorageDead(_29);
StorageDead(_28);
goto -> bb22;
}
bb22: {
StorageDead(_27); StorageDead(_27);
StorageDead(_25); StorageDead(_25);
StorageDead(_23); StorageDead(_23);
@ -266,7 +276,7 @@ fn main() -> () {
return; return;
} }
bb21 (cleanup): { bb23 (cleanup): {
resume; resume;
} }
} }

View file

@ -67,7 +67,7 @@ fn main() -> () {
StorageLive(_2); StorageLive(_2);
StorageLive(_3); StorageLive(_3);
StorageLive(_4); StorageLive(_4);
_4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21]; _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb23];
} }
bb1: { bb1: {
@ -91,24 +91,29 @@ fn main() -> () {
_11 = &(*_8); _11 = &(*_8);
StorageLive(_12); StorageLive(_12);
_12 = &(*_9); _12 = &(*_9);
_10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21]; _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23];
} }
bb2: { bb2: {
switchInt(move _10) -> [0: bb4, otherwise: bb3]; FakeRead(ForMatchedPlace(None), _2);
unreachable;
} }
bb3: { bb3: {
StorageDead(_12); switchInt(move _10) -> [0: bb5, otherwise: bb4];
StorageDead(_11);
goto -> bb8;
} }
bb4: { bb4: {
goto -> bb5; StorageDead(_12);
StorageDead(_11);
goto -> bb9;
} }
bb5: { bb5: {
goto -> bb6;
}
bb6: {
StorageDead(_12); StorageDead(_12);
StorageDead(_11); StorageDead(_11);
StorageLive(_14); StorageLive(_14);
@ -127,10 +132,10 @@ fn main() -> () {
_19 = &(*_20); _19 = &(*_20);
StorageLive(_21); StorageLive(_21);
_21 = Option::<Arguments<'_>>::None; _21 = Option::<Arguments<'_>>::None;
_15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21; _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb23;
} }
bb6: { bb7: {
StorageDead(_21); StorageDead(_21);
StorageDead(_19); StorageDead(_19);
StorageDead(_17); StorageDead(_17);
@ -142,23 +147,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb7: {
goto -> bb9;
}
bb8: { bb8: {
_1 = const (); goto -> bb10;
goto -> bb9;
} }
bb9: { bb9: {
StorageDead(_10); _1 = const ();
StorageDead(_9);
StorageDead(_8);
goto -> bb10; goto -> bb10;
} }
bb10: { bb10: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb11;
}
bb11: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
@ -168,10 +173,10 @@ fn main() -> () {
StorageLive(_23); StorageLive(_23);
StorageLive(_24); StorageLive(_24);
StorageLive(_25); StorageLive(_25);
_25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21]; _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23];
} }
bb11: { bb12: {
_24 = &_25; _24 = &_25;
StorageLive(_26); StorageLive(_26);
StorageLive(_27); StorageLive(_27);
@ -190,24 +195,29 @@ fn main() -> () {
_31 = &(*_28); _31 = &(*_28);
StorageLive(_32); StorageLive(_32);
_32 = &(*_29); _32 = &(*_29);
_30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21]; _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23];
}
bb12: {
switchInt(move _30) -> [0: bb14, otherwise: bb13];
} }
bb13: { bb13: {
StorageDead(_32); FakeRead(ForMatchedPlace(None), _23);
StorageDead(_31); unreachable;
goto -> bb18;
} }
bb14: { bb14: {
goto -> bb15; switchInt(move _30) -> [0: bb16, otherwise: bb15];
} }
bb15: { bb15: {
StorageDead(_32);
StorageDead(_31);
goto -> bb20;
}
bb16: {
goto -> bb17;
}
bb17: {
StorageDead(_32); StorageDead(_32);
StorageDead(_31); StorageDead(_31);
StorageLive(_34); StorageLive(_34);
@ -226,10 +236,10 @@ fn main() -> () {
_39 = &(*_40); _39 = &(*_40);
StorageLive(_41); StorageLive(_41);
_41 = Option::<Arguments<'_>>::None; _41 = Option::<Arguments<'_>>::None;
_35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21; _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb23;
} }
bb16: { bb18: {
StorageDead(_41); StorageDead(_41);
StorageDead(_39); StorageDead(_39);
StorageDead(_37); StorageDead(_37);
@ -241,23 +251,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb17: {
goto -> bb19;
}
bb18: {
_22 = const ();
goto -> bb19;
}
bb19: { bb19: {
StorageDead(_30); goto -> bb21;
StorageDead(_29);
StorageDead(_28);
goto -> bb20;
} }
bb20: { bb20: {
_22 = const ();
goto -> bb21;
}
bb21: {
StorageDead(_30);
StorageDead(_29);
StorageDead(_28);
goto -> bb22;
}
bb22: {
StorageDead(_27); StorageDead(_27);
StorageDead(_25); StorageDead(_25);
StorageDead(_23); StorageDead(_23);
@ -266,7 +276,7 @@ fn main() -> () {
return; return;
} }
bb21 (cleanup): { bb23 (cleanup): {
resume; resume;
} }
} }

View file

@ -24,20 +24,20 @@
bb1: { bb1: {
_4 = discriminant(_1); _4 = discriminant(_1);
switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3]; switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb3, otherwise: bb2];
} }
bb2: { bb2: {
unreachable;
}
bb3: {
_0 = const (); _0 = const ();
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb3: {
unreachable;
}
bb4: { bb4: {
StorageLive(_5); StorageLive(_5);
_5 = DFA::B; _5 = DFA::B;

View file

@ -24,20 +24,20 @@
bb1: { bb1: {
_4 = discriminant(_1); _4 = discriminant(_1);
switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3]; switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb3, otherwise: bb2];
} }
bb2: { bb2: {
unreachable;
}
bb3: {
_0 = const (); _0 = const ();
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb3: {
unreachable;
}
bb4: { bb4: {
StorageLive(_5); StorageLive(_5);
_5 = DFA::B; _5 = DFA::B;

View file

@ -56,10 +56,14 @@
StorageLive(_11); StorageLive(_11);
StorageLive(_12); StorageLive(_12);
_10 = discriminant(_4); _10 = discriminant(_4);
switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb2]; switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_9); StorageLive(_9);
_9 = ((_3 as Continue).0: i32); _9 = ((_3 as Continue).0: i32);
_2 = _9; _2 = _9;
@ -70,10 +74,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_6); StorageLive(_6);
_6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
@ -103,8 +103,8 @@
StorageDead(_10); StorageDead(_10);
StorageDead(_4); StorageDead(_4);
_5 = discriminant(_3); _5 = discriminant(_3);
- switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; - switchInt(move _5) -> [0: bb2, 1: bb3, otherwise: bb1];
+ goto -> bb1; + goto -> bb2;
} }
bb6: { bb6: {

View file

@ -56,10 +56,14 @@
StorageLive(_11); StorageLive(_11);
StorageLive(_12); StorageLive(_12);
_10 = discriminant(_4); _10 = discriminant(_4);
switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb2]; switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_9); StorageLive(_9);
_9 = ((_3 as Continue).0: i32); _9 = ((_3 as Continue).0: i32);
_2 = _9; _2 = _9;
@ -70,10 +74,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_6); StorageLive(_6);
_6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>);
@ -103,8 +103,8 @@
StorageDead(_10); StorageDead(_10);
StorageDead(_4); StorageDead(_4);
_5 = discriminant(_3); _5 = discriminant(_3);
- switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; - switchInt(move _5) -> [0: bb2, 1: bb3, otherwise: bb1];
+ goto -> bb1; + goto -> bb2;
} }
bb6: { bb6: {

View file

@ -12,12 +12,12 @@ use std::ops::ControlFlow;
fn too_complex(x: Result<i32, usize>) -> Option<i32> { fn too_complex(x: Result<i32, usize>) -> Option<i32> {
// CHECK-LABEL: fn too_complex( // CHECK-LABEL: fn too_complex(
// CHECK: bb0: { // CHECK: bb0: {
// CHECK: switchInt(move {{_.*}}) -> [0: bb3, 1: bb1, otherwise: bb2]; // CHECK: switchInt(move {{_.*}}) -> [0: bb3, 1: bb2, otherwise: bb1];
// CHECK: bb1: { // CHECK: bb1: {
// CHECK: unreachable;
// CHECK: bb2: {
// CHECK: [[controlflow:_.*]] = ControlFlow::<usize, i32>::Break( // CHECK: [[controlflow:_.*]] = ControlFlow::<usize, i32>::Break(
// CHECK: goto -> bb8; // CHECK: goto -> bb8;
// CHECK: bb2: {
// CHECK: unreachable;
// CHECK: bb3: { // CHECK: bb3: {
// CHECK: [[controlflow]] = ControlFlow::<usize, i32>::Continue( // CHECK: [[controlflow]] = ControlFlow::<usize, i32>::Continue(
// CHECK: goto -> bb4; // CHECK: goto -> bb4;
@ -50,13 +50,13 @@ fn identity(x: Result<i32, i32>) -> Result<i32, i32> {
// CHECK-LABEL: fn identity( // CHECK-LABEL: fn identity(
// CHECK: bb0: { // CHECK: bb0: {
// CHECK: [[x:_.*]] = _1; // CHECK: [[x:_.*]] = _1;
// CHECK: switchInt(move {{_.*}}) -> [0: bb7, 1: bb6, otherwise: bb2]; // CHECK: switchInt(move {{_.*}}) -> [0: bb7, 1: bb6, otherwise: bb1];
// CHECK: bb1: { // CHECK: bb1: {
// CHECK: unreachable;
// CHECK: bb2: {
// CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32); // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32);
// CHECK: _0 = Result::<i32, i32>::Ok( // CHECK: _0 = Result::<i32, i32>::Ok(
// CHECK: goto -> bb4; // CHECK: goto -> bb4;
// CHECK: bb2: {
// CHECK: unreachable;
// CHECK: bb3: { // CHECK: bb3: {
// CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>); // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>);
// CHECK: _0 = Result::<i32, i32>::Err( // CHECK: _0 = Result::<i32, i32>::Err(
@ -64,7 +64,7 @@ fn identity(x: Result<i32, i32>) -> Result<i32, i32> {
// CHECK: bb4: { // CHECK: bb4: {
// CHECK: return; // CHECK: return;
// CHECK: bb5: { // CHECK: bb5: {
// CHECK: goto -> bb1; // CHECK: goto -> bb2;
// CHECK: bb6: { // CHECK: bb6: {
// CHECK: {{_.*}} = move (([[x]] as Err).0: i32); // CHECK: {{_.*}} = move (([[x]] as Err).0: i32);
// CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Break( // CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Break(
@ -93,11 +93,11 @@ fn dfa() {
// CHECK: {{_.*}} = DFA::A; // CHECK: {{_.*}} = DFA::A;
// CHECK: goto -> bb1; // CHECK: goto -> bb1;
// CHECK: bb1: { // CHECK: bb1: {
// CHECK: switchInt({{.*}}) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3]; // CHECK: switchInt({{.*}}) -> [0: bb4, 1: bb5, 2: bb6, 3: bb3, otherwise: bb2];
// CHECK: bb2: { // CHECK: bb2: {
// CHECK: return;
// CHECK: bb3: {
// CHECK: unreachable; // CHECK: unreachable;
// CHECK: bb3: {
// CHECK: return;
// CHECK: bb4: { // CHECK: bb4: {
// CHECK: {{_.*}} = DFA::B; // CHECK: {{_.*}} = DFA::B;
// CHECK: goto -> bb1; // CHECK: goto -> bb1;

View file

@ -30,10 +30,14 @@
bb0: { bb0: {
StorageLive(_2); StorageLive(_2);
_3 = discriminant(_1); _3 = discriminant(_1);
switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_6); StorageLive(_6);
_6 = ((_1 as Err).0: usize); _6 = ((_1 as Err).0: usize);
StorageLive(_7); StorageLive(_7);
@ -45,10 +49,6 @@
+ goto -> bb8; + goto -> bb8;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_4); StorageLive(_4);
_4 = ((_1 as Ok).0: i32); _4 = ((_1 as Ok).0: i32);
@ -62,7 +62,7 @@
bb4: { bb4: {
_8 = discriminant(_2); _8 = discriminant(_2);
- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; - switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb1];
+ goto -> bb6; + goto -> bb6;
} }

View file

@ -30,10 +30,14 @@
bb0: { bb0: {
StorageLive(_2); StorageLive(_2);
_3 = discriminant(_1); _3 = discriminant(_1);
switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_6); StorageLive(_6);
_6 = ((_1 as Err).0: usize); _6 = ((_1 as Err).0: usize);
StorageLive(_7); StorageLive(_7);
@ -45,10 +49,6 @@
+ goto -> bb8; + goto -> bb8;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
StorageLive(_4); StorageLive(_4);
_4 = ((_1 as Ok).0: i32); _4 = ((_1 as Ok).0: i32);
@ -62,7 +62,7 @@
bb4: { bb4: {
_8 = discriminant(_2); _8 = discriminant(_2);
- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; - switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb1];
+ goto -> bb6; + goto -> bb6;
} }

View file

@ -32,33 +32,25 @@
bb0: { bb0: {
PlaceMention(_2); PlaceMention(_2);
- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; - switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb1];
+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; + switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
} }
bb1: { bb1: {
- falseEdge -> [real: bb8, imaginary: bb3]; - switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb2];
+ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; + switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2];
} }
bb2: { bb2: {
- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; - switchInt((_2.0: bool)) -> [0: bb4, otherwise: bb3];
+ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; + switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17];
} }
bb3: { bb3: {
- falseEdge -> [real: bb13, imaginary: bb5]; - falseEdge -> [real: bb20, imaginary: bb4];
- } - }
- -
- bb4: { - bb4: {
- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5];
- }
-
- bb5: {
- falseEdge -> [real: bb20, imaginary: bb6];
- }
-
- bb6: {
StorageLive(_15); StorageLive(_15);
_15 = (_2.1: bool); _15 = (_2.1: bool);
StorageLive(_16); StorageLive(_16);
@ -67,6 +59,14 @@
+ goto -> bb16; + goto -> bb16;
} }
- bb5: {
- falseEdge -> [real: bb13, imaginary: bb3];
- }
-
- bb6: {
- falseEdge -> [real: bb8, imaginary: bb5];
- }
-
- bb7: { - bb7: {
+ bb4: { + bb4: {
_0 = const 1_i32; _0 = const 1_i32;
@ -127,7 +127,7 @@
StorageDead(_9); StorageDead(_9);
StorageDead(_8); StorageDead(_8);
StorageDead(_6); StorageDead(_6);
- falseEdge -> [real: bb2, imaginary: bb3]; - falseEdge -> [real: bb1, imaginary: bb5];
+ goto -> bb1; + goto -> bb1;
} }
@ -184,7 +184,7 @@
StorageDead(_12); StorageDead(_12);
StorageDead(_8); StorageDead(_8);
StorageDead(_6); StorageDead(_6);
- falseEdge -> [real: bb4, imaginary: bb5]; - falseEdge -> [real: bb2, imaginary: bb3];
+ goto -> bb2; + goto -> bb2;
} }

View file

@ -32,33 +32,25 @@
bb0: { bb0: {
PlaceMention(_2); PlaceMention(_2);
- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; - switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb1];
+ switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; + switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1];
} }
bb1: { bb1: {
- falseEdge -> [real: bb8, imaginary: bb3]; - switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb2];
+ switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; + switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2];
} }
bb2: { bb2: {
- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; - switchInt((_2.0: bool)) -> [0: bb4, otherwise: bb3];
+ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; + switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17];
} }
bb3: { bb3: {
- falseEdge -> [real: bb13, imaginary: bb5]; - falseEdge -> [real: bb20, imaginary: bb4];
- } - }
- -
- bb4: { - bb4: {
- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5];
- }
-
- bb5: {
- falseEdge -> [real: bb20, imaginary: bb6];
- }
-
- bb6: {
StorageLive(_15); StorageLive(_15);
_15 = (_2.1: bool); _15 = (_2.1: bool);
StorageLive(_16); StorageLive(_16);
@ -67,6 +59,14 @@
+ goto -> bb16; + goto -> bb16;
} }
- bb5: {
- falseEdge -> [real: bb13, imaginary: bb3];
- }
-
- bb6: {
- falseEdge -> [real: bb8, imaginary: bb5];
- }
-
- bb7: { - bb7: {
+ bb4: { + bb4: {
_0 = const 1_i32; _0 = const 1_i32;
@ -127,7 +127,7 @@
StorageDead(_9); StorageDead(_9);
StorageDead(_8); StorageDead(_8);
StorageDead(_6); StorageDead(_6);
- falseEdge -> [real: bb2, imaginary: bb3]; - falseEdge -> [real: bb1, imaginary: bb5];
+ goto -> bb1; + goto -> bb1;
} }
@ -184,7 +184,7 @@
StorageDead(_12); StorageDead(_12);
StorageDead(_8); StorageDead(_8);
StorageDead(_6); StorageDead(_6);
- falseEdge -> [real: bb4, imaginary: bb5]; - falseEdge -> [real: bb2, imaginary: bb3];
+ goto -> bb2; + goto -> bb2;
} }

View file

@ -32,12 +32,12 @@ fn main() -> () {
} }
bb1: { bb1: {
falseEdge -> [real: bb9, imaginary: bb4]; _3 = const 3_i32;
goto -> bb14;
} }
bb2: { bb2: {
_3 = const 3_i32; falseEdge -> [real: bb9, imaginary: bb4];
goto -> bb14;
} }
bb3: { bb3: {
@ -50,11 +50,11 @@ fn main() -> () {
} }
bb5: { bb5: {
switchInt(_1) -> [4294967295: bb6, otherwise: bb2]; switchInt(_1) -> [4294967295: bb6, otherwise: bb1];
} }
bb6: { bb6: {
falseEdge -> [real: bb13, imaginary: bb2]; falseEdge -> [real: bb13, imaginary: bb1];
} }
bb7: { bb7: {
@ -64,7 +64,7 @@ fn main() -> () {
bb8: { bb8: {
_7 = Lt(_1, const 10_i32); _7 = Lt(_1, const 10_i32);
switchInt(move _7) -> [0: bb3, otherwise: bb1]; switchInt(move _7) -> [0: bb3, otherwise: bb2];
} }
bb9: { bb9: {
@ -83,7 +83,7 @@ fn main() -> () {
bb11: { bb11: {
StorageDead(_9); StorageDead(_9);
falseEdge -> [real: bb2, imaginary: bb4]; falseEdge -> [real: bb1, imaginary: bb4];
} }
bb12: { bb12: {

View file

@ -8,16 +8,16 @@
bb0: { bb0: {
_2 = discriminant(_1); _2 = discriminant(_1);
switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
_0 = const 1_u8; unreachable;
goto -> bb4;
} }
bb2: { bb2: {
unreachable; _0 = const 1_u8;
goto -> bb4;
} }
bb3: { bb3: {

View file

@ -8,16 +8,16 @@
bb0: { bb0: {
_2 = discriminant(_1); _2 = discriminant(_1);
switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
_0 = const 1_i8; unreachable;
goto -> bb4;
} }
bb2: { bb2: {
unreachable; _0 = const 1_i8;
goto -> bb4;
} }
bb3: { bb3: {

View file

@ -15,16 +15,16 @@ fn unwrap(_1: Option<T>) -> T {
bb0: { bb0: {
_2 = discriminant(_1); _2 = discriminant(_1);
switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
StorageLive(_4); unreachable;
_4 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
} }
bb2: { bb2: {
unreachable; StorageLive(_4);
_4 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
} }
bb3: { bb3: {

View file

@ -15,16 +15,16 @@ fn unwrap(_1: Option<T>) -> T {
bb0: { bb0: {
_2 = discriminant(_1); _2 = discriminant(_1);
switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
} }
bb1: { bb1: {
StorageLive(_4); unreachable;
_4 = begin_panic::<&str>(const "explicit panic") -> bb4;
} }
bb2: { bb2: {
unreachable; StorageLive(_4);
_4 = begin_panic::<&str>(const "explicit panic") -> bb4;
} }
bb3: { bb3: {

View file

@ -67,10 +67,14 @@
StorageLive(_7); StorageLive(_7);
_7 = Option::<i32>::Some(const 0_i32); _7 = Option::<i32>::Some(const 0_i32);
_8 = discriminant(_7); _8 = discriminant(_7);
switchInt(move _8) -> [0: bb3, 1: bb1, otherwise: bb2]; switchInt(move _8) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_9); StorageLive(_9);
_27 = const _; _27 = const _;
_9 = &(((*_27) as Some).0: i32); _9 = &(((*_27) as Some).0: i32);
@ -79,10 +83,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
- _6 = const (); - _6 = const ();
goto -> bb4; goto -> bb4;

View file

@ -55,10 +55,14 @@
bb3: { bb3: {
- StorageDead(_8); - StorageDead(_8);
_10 = discriminant(_7); _10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4];
} }
bb4: { bb4: {
unreachable;
}
bb5: {
- StorageLive(_12); - StorageLive(_12);
_12 = ((_7 as Some).0: i32); _12 = ((_7 as Some).0: i32);
- StorageLive(_13); - StorageLive(_13);
@ -74,10 +78,6 @@
goto -> bb2; goto -> bb2;
} }
bb5: {
unreachable;
}
bb6: { bb6: {
_0 = const (); _0 = const ();
- StorageDead(_9); - StorageDead(_9);

View file

@ -55,10 +55,14 @@
bb3: { bb3: {
- StorageDead(_8); - StorageDead(_8);
_10 = discriminant(_7); _10 = discriminant(_7);
switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4];
} }
bb4: { bb4: {
unreachable;
}
bb5: {
- StorageLive(_12); - StorageLive(_12);
_12 = ((_7 as Some).0: i32); _12 = ((_7 as Some).0: i32);
- StorageLive(_13); - StorageLive(_13);
@ -74,10 +78,6 @@
goto -> bb2; goto -> bb2;
} }
bb5: {
unreachable;
}
bb6: { bb6: {
_0 = const (); _0 = const ();
- StorageDead(_9); - StorageDead(_9);

View file

@ -18,10 +18,14 @@
- _5 = const false; - _5 = const false;
- _5 = const true; - _5 = const true;
_2 = discriminant(_1); _2 = discriminant(_1);
switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_3); StorageLive(_3);
_3 = move ((_1 as Some).0: std::boxed::Box<()>); _3 = move ((_1 as Some).0: std::boxed::Box<()>);
StorageLive(_4); StorageLive(_4);
@ -32,10 +36,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
_0 = Option::<Box<()>>::None; _0 = Option::<Box<()>>::None;
goto -> bb4; goto -> bb4;

View file

@ -30,11 +30,15 @@
StorageLive(_4); StorageLive(_4);
_4 = &(_1.1: Test3); _4 = &(_1.1: Test3);
_5 = discriminant((*_4)); _5 = discriminant((*_4));
- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2]; - switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb2, otherwise: bb1];
+ switchInt(move _5) -> [0: bb12, 1: bb12, 2: bb5, 3: bb1, otherwise: bb12]; + switchInt(move _5) -> [0: bb12, 1: bb12, 2: bb5, 3: bb2, otherwise: bb12];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_8); StorageLive(_8);
_8 = const "D"; _8 = const "D";
_3 = &(*_8); _3 = &(*_8);
@ -42,10 +46,6 @@
goto -> bb6; goto -> bb6;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
_3 = const "A(Empty)"; _3 = const "A(Empty)";
goto -> bb6; goto -> bb6;
@ -72,7 +72,7 @@
StorageDead(_3); StorageDead(_3);
StorageLive(_9); StorageLive(_9);
_10 = discriminant((_1.1: Test3)); _10 = discriminant((_1.1: Test3));
- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2]; - switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb1];
+ switchInt(move _10) -> [0: bb12, 1: bb12, 2: bb10, 3: bb7, otherwise: bb12]; + switchInt(move _10) -> [0: bb12, 1: bb12, 2: bb10, 3: bb7, otherwise: bb12];
} }

View file

@ -13,11 +13,15 @@
StorageLive(_2); StorageLive(_2);
_2 = Test2::D; _2 = Test2::D;
_3 = discriminant(_2); _3 = discriminant(_2);
- switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb2]; - switchInt(move _3) -> [4: bb3, 5: bb2, otherwise: bb1];
+ switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb5]; + switchInt(move _3) -> [4: bb3, 5: bb2, otherwise: bb5];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_4); StorageLive(_4);
_4 = const "E"; _4 = const "E";
_1 = &(*_4); _1 = &(*_4);
@ -25,10 +29,6 @@
goto -> bb4; goto -> bb4;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
_1 = const "D"; _1 = const "D";
goto -> bb4; goto -> bb4;

View file

@ -32,7 +32,7 @@ struct Plop {
fn simple() { fn simple() {
// CHECK-LABEL: fn simple( // CHECK-LABEL: fn simple(
// CHECK: [[discr:_.*]] = discriminant( // CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]]; // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb2, otherwise: [[unreachable]]];
// CHECK: [[unreachable]]: { // CHECK: [[unreachable]]: {
// CHECK-NEXT: unreachable; // CHECK-NEXT: unreachable;
match Test1::C { match Test1::C {
@ -46,7 +46,7 @@ fn simple() {
fn custom_discriminant() { fn custom_discriminant() {
// CHECK-LABEL: fn custom_discriminant( // CHECK-LABEL: fn custom_discriminant(
// CHECK: [[discr:_.*]] = discriminant( // CHECK: [[discr:_.*]] = discriminant(
// CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb1, otherwise: bb5]; // CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb2, otherwise: bb5];
// CHECK: bb5: { // CHECK: bb5: {
// CHECK-NEXT: unreachable; // CHECK-NEXT: unreachable;
match Test2::D { match Test2::D {
@ -61,7 +61,7 @@ fn byref() {
let plop = Plop { xx: 51, test3: Test3::C }; let plop = Plop { xx: 51, test3: Test3::C };
// CHECK: [[ref_discr:_.*]] = discriminant((* // CHECK: [[ref_discr:_.*]] = discriminant((*
// CHECK: switchInt(move [[ref_discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb5, 3: bb1, otherwise: [[unreachable]]]; // CHECK: switchInt(move [[ref_discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb5, 3: bb2, otherwise: [[unreachable]]];
match &plop.test3 { match &plop.test3 {
Test3::A(_) => "A(Empty)", Test3::A(_) => "A(Empty)",
Test3::B(_) => "B(Empty)", Test3::B(_) => "B(Empty)",

View file

@ -14,11 +14,15 @@
StorageLive(_2); StorageLive(_2);
_2 = Test1::C; _2 = Test1::C;
_3 = discriminant(_2); _3 = discriminant(_2);
- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb1, otherwise: bb2]; - switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb2, otherwise: bb1];
+ switchInt(move _3) -> [0: bb6, 1: bb6, 2: bb1, otherwise: bb6]; + switchInt(move _3) -> [0: bb6, 1: bb6, 2: bb2, otherwise: bb6];
} }
bb1: { bb1: {
unreachable;
}
bb2: {
StorageLive(_5); StorageLive(_5);
_5 = const "C"; _5 = const "C";
_1 = &(*_5); _1 = &(*_5);
@ -26,10 +30,6 @@
goto -> bb5; goto -> bb5;
} }
bb2: {
unreachable;
}
bb3: { bb3: {
_1 = const "A(Empty)"; _1 = const "A(Empty)";
goto -> bb5; goto -> bb5;

View file

@ -19,20 +19,20 @@
bb1: { bb1: {
_2 = discriminant(_1); _2 = discriminant(_1);
- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3]; - switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2];
+ _5 = Eq(_2, const 0_isize); + _5 = Eq(_2, const 0_isize);
+ assume(move _5); + assume(move _5);
+ goto -> bb4; + goto -> bb4;
} }
bb2: { bb2: {
- StorageLive(_3);
- _3 = move ((_1 as Some).0: Empty);
- StorageLive(_4);
unreachable; unreachable;
} }
bb3: { bb3: {
- StorageLive(_3);
- _3 = move ((_1 as Some).0: Empty);
- StorageLive(_4);
unreachable; unreachable;
} }

View file

@ -19,20 +19,20 @@
bb1: { bb1: {
_2 = discriminant(_1); _2 = discriminant(_1);
- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3]; - switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2];
+ _5 = Eq(_2, const 0_isize); + _5 = Eq(_2, const 0_isize);
+ assume(move _5); + assume(move _5);
+ goto -> bb4; + goto -> bb4;
} }
bb2: { bb2: {
- StorageLive(_3);
- _3 = move ((_1 as Some).0: Empty);
- StorageLive(_4);
unreachable; unreachable;
} }
bb3: { bb3: {
- StorageLive(_3);
- _3 = move ((_1 as Some).0: Empty);
- StorageLive(_4);
unreachable; unreachable;
} }