1
Fork 0

Return the otherwise_block instead of passing it as argument

This saves a few blocks and matches the common `unpack!` paradigm.
This commit is contained in:
Nadrieril 2024-06-30 13:21:12 +02:00
parent fc40247c6b
commit 3e030b38ef
19 changed files with 368 additions and 496 deletions

View file

@ -1313,11 +1313,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
candidates: &mut [&mut Candidate<'pat, 'tcx>], candidates: &mut [&mut Candidate<'pat, 'tcx>],
refutable: bool, refutable: bool,
) -> BasicBlock { ) -> BasicBlock {
// This will generate code to test scrutinee_place and branch to the appropriate arm block.
// See the doc comment on `match_candidates` for why we have an otherwise block. // See the doc comment on `match_candidates` for why we have an otherwise block.
let otherwise_block = self.cfg.start_new_block(); let otherwise_block =
self.match_candidates(match_start_span, scrutinee_span, block, candidates);
// This will generate code to test scrutinee_place and branch to the appropriate arm block
self.match_candidates(match_start_span, scrutinee_span, block, otherwise_block, candidates);
// Link each leaf candidate to the `false_edge_start_block` of the next one. // Link each leaf candidate to the `false_edge_start_block` of the next one.
let mut previous_candidate: Option<&mut Candidate<'_, '_>> = None; let mut previous_candidate: Option<&mut Candidate<'_, '_>> = None;
@ -1368,27 +1367,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
otherwise_block otherwise_block
} }
/// The main match algorithm. It begins with a set of candidates /// The main match algorithm. It begins with a set of candidates `candidates` and has the job of
/// `candidates` and has the job of generating code to determine /// generating code that branches to an appropriate block if the scrutinee matches one of these
/// which of these candidates, if any, is the correct one. The /// candidates. The
/// candidates are sorted such that the first item in the list /// candidates are sorted such that the first item in the list
/// has the highest priority. When a candidate is found to match /// has the highest priority. When a candidate is found to match
/// the value, we will set and generate a branch to the appropriate /// the value, we will set and generate a branch to the appropriate
/// pre-binding block. /// pre-binding block.
/// ///
/// If we find that *NONE* of the candidates apply, we branch to `otherwise_block`. /// If none of the candidates apply, we continue to the returned `otherwise_block`.
/// ///
/// It might be surprising that the input can be non-exhaustive. /// It might be surprising that the input can be non-exhaustive.
/// Indeed, initially, it is not, because all matches are /// Indeed, for matches, initially, it is not, because all matches are
/// exhaustive in Rust. But during processing we sometimes divide /// exhaustive in Rust. But during processing we sometimes divide
/// up the list of candidates and recurse with a non-exhaustive /// up the list of candidates and recurse with a non-exhaustive
/// list. This is how our lowering approach (called "backtracking /// list. This is how our lowering approach (called "backtracking
/// automaton" in the literature) works. /// automaton" in the literature) works.
/// See [`Builder::test_candidates`] for more details. /// See [`Builder::test_candidates`] for more details.
/// ///
/// If `fake_borrows` is `Some`, then places which need fake borrows
/// will be added to it.
///
/// For an example of how we use `otherwise_block`, consider: /// For an example of how we use `otherwise_block`, consider:
/// ``` /// ```
/// # fn foo((x, y): (bool, bool)) -> u32 { /// # fn foo((x, y): (bool, bool)) -> u32 {
@ -1413,7 +1409,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// } /// }
/// if y { /// if y {
/// if x { /// if x {
/// // This is actually unreachable because the `(true, true)` case was handled above. /// // This is actually unreachable because the `(true, true)` case was handled above,
/// // but we don't know that from within the lowering algorithm.
/// // continue /// // continue
/// } else { /// } else {
/// return 3 /// return 3
@ -1430,25 +1427,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// the algorithm. For more details on why we lower like this, see [`Builder::test_candidates`]. /// the algorithm. For more details on why we lower like this, see [`Builder::test_candidates`].
/// ///
/// Note how we test `x` twice. This is the tradeoff of backtracking automata: we prefer smaller /// Note how we test `x` twice. This is the tradeoff of backtracking automata: we prefer smaller
/// code size at the expense of non-optimal code paths. /// code size so we accept non-optimal code paths.
#[instrument(skip(self), level = "debug")] #[instrument(skip(self), level = "debug")]
fn match_candidates( fn match_candidates(
&mut self, &mut self,
span: Span, span: Span,
scrutinee_span: Span, scrutinee_span: Span,
start_block: BasicBlock, start_block: BasicBlock,
otherwise_block: BasicBlock,
candidates: &mut [&mut Candidate<'_, 'tcx>], candidates: &mut [&mut Candidate<'_, 'tcx>],
) { ) -> BasicBlock {
ensure_sufficient_stack(|| { ensure_sufficient_stack(|| {
self.match_candidates_with_enough_stack( self.match_candidates_with_enough_stack(span, scrutinee_span, start_block, candidates)
span, })
scrutinee_span,
start_block,
otherwise_block,
candidates,
)
});
} }
/// Construct the decision tree for `candidates`. Don't call this, call `match_candidates` /// Construct the decision tree for `candidates`. Don't call this, call `match_candidates`
@ -1458,9 +1448,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
span: Span, span: Span,
scrutinee_span: Span, scrutinee_span: Span,
start_block: BasicBlock, start_block: BasicBlock,
otherwise_block: BasicBlock,
candidates: &mut [&mut Candidate<'_, 'tcx>], candidates: &mut [&mut Candidate<'_, 'tcx>],
) { ) -> BasicBlock {
if let [first, ..] = candidates { if let [first, ..] = candidates {
if first.false_edge_start_block.is_none() { if first.false_edge_start_block.is_none() {
first.false_edge_start_block = Some(start_block); first.false_edge_start_block = Some(start_block);
@ -1471,9 +1460,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let rest = match candidates { let rest = match candidates {
[] => { [] => {
// If there are no candidates that still need testing, we're done. // If there are no candidates that still need testing, we're done.
let source_info = self.source_info(span); return start_block;
self.cfg.goto(start_block, source_info, otherwise_block);
return;
} }
[first, remaining @ ..] if first.match_pairs.is_empty() => { [first, remaining @ ..] if first.match_pairs.is_empty() => {
// The first candidate has satisfied all its match pairs; we link it up and continue // The first candidate has satisfied all its match pairs; we link it up and continue
@ -1494,13 +1481,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Process any candidates that remain. // Process any candidates that remain.
let BlockAnd(start_block, remaining_candidates) = rest; let BlockAnd(start_block, remaining_candidates) = rest;
self.match_candidates( self.match_candidates(span, scrutinee_span, start_block, remaining_candidates)
span,
scrutinee_span,
start_block,
otherwise_block,
remaining_candidates,
);
} }
/// Link up matched candidates. /// Link up matched candidates.
@ -1605,14 +1586,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} }
// Process the expanded candidates. // Process the expanded candidates.
let remainder_start = self.cfg.start_new_block(); let remainder_start = self.match_candidates(
// There might be new or-patterns obtained from expanding the old ones, so we call
// `match_candidates` again.
self.match_candidates(
span, span,
scrutinee_span, scrutinee_span,
start_block, start_block,
remainder_start,
expanded_candidates.as_mut_slice(), expanded_candidates.as_mut_slice(),
); );
@ -1711,6 +1688,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.merge_trivial_subcandidates(candidate); self.merge_trivial_subcandidates(candidate);
if !candidate.match_pairs.is_empty() { if !candidate.match_pairs.is_empty() {
let or_span = candidate.or_span.unwrap_or(candidate.extra_data.span);
let source_info = self.source_info(or_span);
// If more match pairs remain, test them after each subcandidate. // If more match pairs remain, test them after each subcandidate.
// We could add them to the or-candidates before the call to `test_or_pattern` but this // We could add them to the or-candidates before the call to `test_or_pattern` but this
// would make it impossible to detect simplifiable or-patterns. That would guarantee // would make it impossible to detect simplifiable or-patterns. That would guarantee
@ -1724,6 +1703,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
assert!(leaf_candidate.match_pairs.is_empty()); assert!(leaf_candidate.match_pairs.is_empty());
leaf_candidate.match_pairs.extend(remaining_match_pairs.iter().cloned()); leaf_candidate.match_pairs.extend(remaining_match_pairs.iter().cloned());
let or_start = leaf_candidate.pre_binding_block.unwrap(); let or_start = leaf_candidate.pre_binding_block.unwrap();
let otherwise =
self.match_candidates(span, scrutinee_span, or_start, &mut [leaf_candidate]);
// In a case like `(P | Q, R | S)`, if `P` succeeds and `R | S` fails, we know `(Q, // In a case like `(P | Q, R | S)`, if `P` succeeds and `R | S` fails, we know `(Q,
// R | S)` will fail too. If there is no guard, we skip testing of `Q` by branching // R | S)` will fail too. If there is no guard, we skip testing of `Q` by branching
// directly to `last_otherwise`. If there is a guard, // directly to `last_otherwise`. If there is a guard,
@ -1734,13 +1715,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} else { } else {
last_otherwise.unwrap() last_otherwise.unwrap()
}; };
self.match_candidates( self.cfg.goto(otherwise, source_info, or_otherwise);
span,
scrutinee_span,
or_start,
or_otherwise,
&mut [leaf_candidate],
);
}); });
} }
} }
@ -2019,15 +1994,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let target_blocks: FxIndexMap<_, _> = target_candidates let target_blocks: FxIndexMap<_, _> = target_candidates
.into_iter() .into_iter()
.map(|(branch, mut candidates)| { .map(|(branch, mut candidates)| {
let candidate_start = self.cfg.start_new_block(); let branch_start = self.cfg.start_new_block();
self.match_candidates( let branch_otherwise =
span, self.match_candidates(span, scrutinee_span, branch_start, &mut *candidates);
scrutinee_span, let source_info = self.source_info(span);
candidate_start, self.cfg.goto(branch_otherwise, source_info, remainder_start);
remainder_start, (branch, branch_start)
&mut *candidates,
);
(branch, candidate_start)
}) })
.collect(); .collect();

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: bb5, otherwise: bb4]; switchInt(move _6) -> [1: bb4, otherwise: bb3];
} }
bb1: { bb1: {
StorageLive(_3); StorageLive(_3);
StorageLive(_4); StorageLive(_4);
_4 = begin_panic::<&str>(const "explicit panic") -> bb9; _4 = begin_panic::<&str>(const "explicit panic") -> bb8;
} }
bb2: { bb2: {
@ -43,22 +43,18 @@ fn main() -> () {
} }
bb3: { bb3: {
goto -> bb8; goto -> bb7;
} }
bb4: { bb4: {
goto -> bb3; falseEdge -> [real: bb6, imaginary: bb3];
} }
bb5: { bb5: {
falseEdge -> [real: bb7, imaginary: bb3]; goto -> bb3;
} }
bb6: { bb6: {
goto -> bb4;
}
bb7: {
_5 = ((_1 as Some).0: u8); _5 = ((_1 as Some).0: u8);
_0 = const (); _0 = const ();
StorageDead(_5); StorageDead(_5);
@ -66,12 +62,12 @@ fn main() -> () {
return; return;
} }
bb8: { bb7: {
StorageDead(_5); StorageDead(_5);
goto -> bb1; goto -> bb1;
} }
bb9 (cleanup): { bb8 (cleanup): {
resume; resume;
} }
} }

View file

@ -17,7 +17,7 @@ fn main() -> () {
} }
bb1: { bb1: {
falseUnwind -> [real: bb2, unwind: bb15]; falseUnwind -> [real: bb2, unwind: bb14];
} }
bb2: { bb2: {
@ -25,7 +25,7 @@ fn main() -> () {
StorageLive(_3); StorageLive(_3);
_3 = const true; _3 = const true;
PlaceMention(_3); PlaceMention(_3);
switchInt(_3) -> [0: bb5, otherwise: bb7]; switchInt(_3) -> [0: bb4, otherwise: bb6];
} }
bb3: { bb3: {
@ -34,49 +34,45 @@ fn main() -> () {
} }
bb4: { bb4: {
goto -> bb3; falseEdge -> [real: bb8, imaginary: bb6];
} }
bb5: { bb5: {
falseEdge -> [real: bb9, imaginary: bb7]; goto -> bb3;
} }
bb6: { bb6: {
goto -> bb4; _0 = const ();
goto -> bb13;
} }
bb7: { bb7: {
_0 = const (); goto -> bb3;
goto -> bb14;
} }
bb8: { bb8: {
goto -> bb4; _2 = const 4_i32;
goto -> bb11;
} }
bb9: { bb9: {
_2 = const 4_i32;
goto -> bb12;
}
bb10: {
unreachable; unreachable;
} }
bb11: { bb10: {
goto -> bb12; goto -> bb11;
} }
bb12: { bb11: {
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: bb13, unwind: bb15]; _5 = std::mem::drop::<&i32>(move _6) -> [return: bb12, unwind: bb14];
} }
bb13: { bb12: {
StorageDead(_6); StorageDead(_6);
StorageDead(_5); StorageDead(_5);
_1 = const (); _1 = const ();
@ -84,13 +80,13 @@ fn main() -> () {
goto -> bb1; goto -> bb1;
} }
bb14: { bb13: {
StorageDead(_3); StorageDead(_3);
StorageDead(_2); StorageDead(_2);
return; return;
} }
bb15 (cleanup): { bb14 (cleanup): {
resume; resume;
} }
} }

View file

@ -19,188 +19,180 @@ fn test_complex() -> () {
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
StorageLive(_2); StorageLive(_2);
_2 = E::f() -> [return: bb1, unwind: bb36]; _2 = E::f() -> [return: bb1, unwind: bb34];
} }
bb1: { bb1: {
PlaceMention(_2); PlaceMention(_2);
_3 = discriminant(_2); _3 = discriminant(_2);
switchInt(move _3) -> [0: bb4, otherwise: bb3]; switchInt(move _3) -> [0: bb3, otherwise: bb2];
} }
bb2: { bb2: {
goto -> bb22; goto -> bb21;
} }
bb3: { bb3: {
goto -> bb2; falseEdge -> [real: bb5, imaginary: bb2];
} }
bb4: { bb4: {
falseEdge -> [real: bb6, imaginary: bb2]; goto -> bb2;
} }
bb5: { bb5: {
goto -> bb3; StorageLive(_4);
_4 = always_true() -> [return: bb6, unwind: bb34];
} }
bb6: { bb6: {
StorageLive(_4); switchInt(move _4) -> [0: bb8, otherwise: bb7];
_4 = always_true() -> [return: bb7, unwind: bb36];
} }
bb7: { bb7: {
switchInt(move _4) -> [0: bb9, otherwise: bb8];
}
bb8: {
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: bb11, otherwise: bb10]; switchInt(move _5) -> [0: bb10, otherwise: bb9];
}
bb8: {
goto -> bb14;
} }
bb9: { bb9: {
goto -> bb15; drop(_7) -> [return: bb11, unwind: bb34];
} }
bb10: { bb10: {
drop(_7) -> [return: bb12, unwind: bb36]; goto -> bb12;
} }
bb11: { bb11: {
goto -> bb13; StorageDead(_7);
StorageDead(_6);
goto -> bb18;
} }
bb12: { bb12: {
StorageDead(_7); drop(_7) -> [return: bb13, unwind: bb34];
StorageDead(_6);
goto -> bb19;
} }
bb13: { bb13: {
drop(_7) -> [return: bb14, unwind: bb36]; StorageDead(_7);
StorageDead(_6);
goto -> bb14;
} }
bb14: { bb14: {
StorageDead(_7);
StorageDead(_6);
goto -> bb15;
}
bb15: {
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: bb17, otherwise: bb16]; switchInt(move _8) -> [0: bb16, otherwise: bb15];
}
bb15: {
drop(_10) -> [return: bb17, unwind: bb34];
} }
bb16: { bb16: {
drop(_10) -> [return: bb18, unwind: bb36];
}
bb17: {
goto -> bb20;
}
bb18: {
StorageDead(_10);
StorageDead(_9);
goto -> bb19; goto -> bb19;
} }
bb19: { bb17: {
StorageDead(_10);
StorageDead(_9);
goto -> bb18;
}
bb18: {
_1 = const (); _1 = const ();
goto -> bb23; goto -> bb22;
}
bb19: {
drop(_10) -> [return: bb20, unwind: bb34];
} }
bb20: { bb20: {
drop(_10) -> [return: bb21, unwind: bb36]; StorageDead(_10);
StorageDead(_9);
goto -> bb21;
} }
bb21: { bb21: {
StorageDead(_10); _1 = const ();
StorageDead(_9);
goto -> bb22; goto -> bb22;
} }
bb22: { bb22: {
_1 = const ();
goto -> bb23;
}
bb23: {
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: bb24, unwind: bb36]; _11 = always_true() -> [return: bb23, unwind: bb34];
}
bb23: {
switchInt(move _11) -> [0: bb25, otherwise: bb24];
} }
bb24: { bb24: {
switchInt(move _11) -> [0: bb26, otherwise: bb25]; goto -> bb32;
} }
bb25: { bb25: {
goto -> bb34; goto -> bb26;
} }
bb26: { bb26: {
goto -> bb27; StorageLive(_12);
_12 = E::f() -> [return: bb27, unwind: bb34];
} }
bb27: { bb27: {
StorageLive(_12); PlaceMention(_12);
_12 = E::f() -> [return: bb28, unwind: bb36]; _13 = discriminant(_12);
switchInt(move _13) -> [1: bb29, otherwise: bb28];
} }
bb28: { bb28: {
PlaceMention(_12); goto -> bb32;
_13 = discriminant(_12);
switchInt(move _13) -> [1: bb31, otherwise: bb30];
} }
bb29: { bb29: {
goto -> bb34; falseEdge -> [real: bb31, imaginary: bb28];
} }
bb30: { bb30: {
goto -> bb29; goto -> bb28;
} }
bb31: { bb31: {
falseEdge -> [real: bb33, imaginary: bb29]; _0 = const ();
goto -> bb33;
} }
bb32: { bb32: {
goto -> bb30; _0 = const ();
goto -> bb33;
} }
bb33: { bb33: {
_0 = const ();
goto -> bb35;
}
bb34: {
_0 = const ();
goto -> bb35;
}
bb35: {
StorageDead(_11); StorageDead(_11);
StorageDead(_12); StorageDead(_12);
return; return;
} }
bb36 (cleanup): { bb34 (cleanup): {
resume; resume;
} }
} }

View file

@ -28,7 +28,7 @@ fn full_tested_match() -> () {
_2 = Option::<i32>::Some(const 42_i32); _2 = Option::<i32>::Some(const 42_i32);
PlaceMention(_2); PlaceMention(_2);
_4 = discriminant(_2); _4 = discriminant(_2);
switchInt(move _4) -> [0: bb6, 1: bb3, otherwise: bb2]; switchInt(move _4) -> [0: bb5, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
@ -37,43 +37,39 @@ fn full_tested_match() -> () {
} }
bb2: { bb2: {
goto -> bb1; falseEdge -> [real: bb7, imaginary: bb3];
} }
bb3: { bb3: {
falseEdge -> [real: bb8, imaginary: bb4]; falseEdge -> [real: bb12, imaginary: bb5];
} }
bb4: { bb4: {
falseEdge -> [real: bb13, imaginary: bb6]; goto -> bb1;
} }
bb5: { bb5: {
goto -> bb2; _1 = (const 3_i32, const 3_i32);
goto -> bb13;
} }
bb6: { bb6: {
_1 = (const 3_i32, const 3_i32); goto -> bb1;
goto -> bb14;
} }
bb7: { bb7: {
goto -> bb2;
}
bb8: {
StorageLive(_6); StorageLive(_6);
_6 = &((_2 as Some).0: i32); _6 = &((_2 as Some).0: i32);
_3 = &fake shallow _2; _3 = &fake shallow _2;
StorageLive(_7); StorageLive(_7);
_7 = guard() -> [return: bb9, unwind: bb17]; _7 = guard() -> [return: bb8, unwind: bb15];
}
bb8: {
switchInt(move _7) -> [0: bb10, otherwise: bb9];
} }
bb9: { bb9: {
switchInt(move _7) -> [0: bb11, otherwise: bb10];
}
bb10: {
StorageDead(_7); StorageDead(_7);
FakeRead(ForMatchGuard, _3); FakeRead(ForMatchGuard, _3);
FakeRead(ForGuardBinding, _6); FakeRead(ForGuardBinding, _6);
@ -85,20 +81,20 @@ fn full_tested_match() -> () {
StorageDead(_8); StorageDead(_8);
StorageDead(_5); StorageDead(_5);
StorageDead(_6); StorageDead(_6);
goto -> bb14; goto -> bb13;
}
bb10: {
goto -> bb11;
} }
bb11: { bb11: {
goto -> bb12; StorageDead(_7);
StorageDead(_6);
goto -> bb3;
} }
bb12: { bb12: {
StorageDead(_7);
StorageDead(_6);
goto -> bb4;
}
bb13: {
StorageLive(_9); StorageLive(_9);
_9 = ((_2 as Some).0: i32); _9 = ((_2 as Some).0: i32);
StorageLive(_10); StorageLive(_10);
@ -106,10 +102,10 @@ fn full_tested_match() -> () {
_1 = (const 2_i32, move _10); _1 = (const 2_i32, move _10);
StorageDead(_10); StorageDead(_10);
StorageDead(_9); StorageDead(_9);
goto -> bb14; goto -> bb13;
} }
bb14: { bb13: {
PlaceMention(_1); PlaceMention(_1);
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
@ -117,16 +113,12 @@ fn full_tested_match() -> () {
return; return;
} }
bb15: { bb14: {
FakeRead(ForMatchedPlace(None), _1); FakeRead(ForMatchedPlace(None), _1);
unreachable; unreachable;
} }
bb16: { bb15 (cleanup): {
goto -> bb15;
}
bb17 (cleanup): {
resume; resume;
} }
} }

View file

@ -28,7 +28,7 @@ fn full_tested_match2() -> () {
_2 = Option::<i32>::Some(const 42_i32); _2 = Option::<i32>::Some(const 42_i32);
PlaceMention(_2); PlaceMention(_2);
_4 = discriminant(_2); _4 = discriminant(_2);
switchInt(move _4) -> [0: bb6, 1: bb3, otherwise: bb2]; switchInt(move _4) -> [0: bb5, 1: bb2, otherwise: bb1];
} }
bb1: { bb1: {
@ -37,14 +37,10 @@ fn full_tested_match2() -> () {
} }
bb2: { bb2: {
goto -> bb1; falseEdge -> [real: bb7, imaginary: bb5];
} }
bb3: { bb3: {
falseEdge -> [real: bb8, imaginary: bb6];
}
bb4: {
StorageLive(_9); StorageLive(_9);
_9 = ((_2 as Some).0: i32); _9 = ((_2 as Some).0: i32);
StorageLive(_10); StorageLive(_10);
@ -52,34 +48,34 @@ fn full_tested_match2() -> () {
_1 = (const 2_i32, move _10); _1 = (const 2_i32, move _10);
StorageDead(_10); StorageDead(_10);
StorageDead(_9); StorageDead(_9);
goto -> bb14; goto -> bb13;
}
bb4: {
goto -> bb1;
} }
bb5: { bb5: {
goto -> bb2; falseEdge -> [real: bb12, imaginary: bb3];
} }
bb6: { bb6: {
falseEdge -> [real: bb13, imaginary: bb4]; goto -> bb1;
} }
bb7: { bb7: {
goto -> bb2;
}
bb8: {
StorageLive(_6); StorageLive(_6);
_6 = &((_2 as Some).0: i32); _6 = &((_2 as Some).0: i32);
_3 = &fake shallow _2; _3 = &fake shallow _2;
StorageLive(_7); StorageLive(_7);
_7 = guard() -> [return: bb9, unwind: bb17]; _7 = guard() -> [return: bb8, unwind: bb15];
}
bb8: {
switchInt(move _7) -> [0: bb10, otherwise: bb9];
} }
bb9: { bb9: {
switchInt(move _7) -> [0: bb11, otherwise: bb10];
}
bb10: {
StorageDead(_7); StorageDead(_7);
FakeRead(ForMatchGuard, _3); FakeRead(ForMatchGuard, _3);
FakeRead(ForGuardBinding, _6); FakeRead(ForGuardBinding, _6);
@ -91,25 +87,25 @@ fn full_tested_match2() -> () {
StorageDead(_8); StorageDead(_8);
StorageDead(_5); StorageDead(_5);
StorageDead(_6); StorageDead(_6);
goto -> bb14; goto -> bb13;
}
bb10: {
goto -> bb11;
} }
bb11: { bb11: {
goto -> bb12; StorageDead(_7);
StorageDead(_6);
falseEdge -> [real: bb3, imaginary: bb5];
} }
bb12: { bb12: {
StorageDead(_7); _1 = (const 3_i32, const 3_i32);
StorageDead(_6); goto -> bb13;
falseEdge -> [real: bb4, imaginary: bb6];
} }
bb13: { bb13: {
_1 = (const 3_i32, const 3_i32);
goto -> bb14;
}
bb14: {
PlaceMention(_1); PlaceMention(_1);
StorageDead(_2); StorageDead(_2);
StorageDead(_1); StorageDead(_1);
@ -117,16 +113,12 @@ fn full_tested_match2() -> () {
return; return;
} }
bb15: { bb14: {
FakeRead(ForMatchedPlace(None), _1); FakeRead(ForMatchedPlace(None), _1);
unreachable; unreachable;
} }
bb16: { bb15 (cleanup): {
goto -> bb15;
}
bb17 (cleanup): {
resume; resume;
} }
} }

View file

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

View file

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

View file

@ -8,7 +8,7 @@ fn match_enum(_1: E1) -> bool {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
_2 = discriminant(_1); _2 = discriminant(_1);
switchInt(move _2) -> [0: bb4, 1: bb6, 2: bb8, otherwise: bb3]; switchInt(move _2) -> [0: bb2, 1: bb4, 2: bb6, otherwise: bb1];
} }
bb1: { bb1: {
@ -17,48 +17,40 @@ fn match_enum(_1: E1) -> bool {
} }
bb2: { bb2: {
goto -> bb1; goto -> bb8;
} }
bb3: { bb3: {
goto -> bb2; goto -> bb1;
} }
bb4: { bb4: {
goto -> bb10; goto -> bb8;
} }
bb5: { bb5: {
goto -> bb3; goto -> bb1;
} }
bb6: { bb6: {
_0 = const false;
goto -> bb10; goto -> bb10;
} }
bb7: { bb7: {
goto -> bb3; goto -> bb1;
} }
bb8: { bb8: {
_0 = const false; falseEdge -> [real: bb9, imaginary: bb6];
goto -> bb12;
} }
bb9: { bb9: {
goto -> bb3; _0 = const true;
goto -> bb10;
} }
bb10: { bb10: {
falseEdge -> [real: bb11, imaginary: bb8];
}
bb11: {
_0 = const true;
goto -> bb12;
}
bb12: {
return; return;
} }
} }

View file

@ -26,7 +26,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: bb14]; _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13];
} }
bb1: { bb1: {
@ -34,7 +34,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: bb13]; drop(_6) -> [return: bb2, unwind: bb12];
} }
bb2: { bb2: {
@ -42,7 +42,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: bb13]; _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12];
} }
bb3: { bb3: {
@ -50,18 +50,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: bb12]; 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: bb13]; drop(_7) -> [return: bb5, unwind: bb12];
} }
bb5: { bb5: {
StorageDead(_7); StorageDead(_7);
drop(_2) -> [return: bb6, unwind: bb14]; drop(_2) -> [return: bb6, unwind: bb13];
} }
bb6: { bb6: {
@ -71,7 +71,7 @@ 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: bb9, unwind: bb11]; drop(_12) -> [return: bb8, unwind: bb10];
} }
bb7: { bb7: {
@ -80,32 +80,28 @@ fn move_out_by_subslice() -> () {
} }
bb8: { bb8: {
goto -> bb7; StorageDead(_12);
drop(_1) -> [return: bb9, unwind: bb13];
} }
bb9: { bb9: {
StorageDead(_12);
drop(_1) -> [return: bb10, unwind: bb14];
}
bb10: {
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb10 (cleanup): {
drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb11 (cleanup): { bb11 (cleanup): {
drop(_1) -> [return: bb14, unwind terminate(cleanup)]; drop(_7) -> [return: bb12, unwind terminate(cleanup)];
} }
bb12 (cleanup): { bb12 (cleanup): {
drop(_7) -> [return: bb13, unwind terminate(cleanup)]; drop(_2) -> [return: bb13, unwind terminate(cleanup)];
} }
bb13 (cleanup): { bb13 (cleanup): {
drop(_2) -> [return: bb14, unwind terminate(cleanup)];
}
bb14 (cleanup): {
resume; resume;
} }
} }

View file

@ -26,7 +26,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: bb14]; _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13];
} }
bb1: { bb1: {
@ -34,7 +34,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: bb13]; drop(_6) -> [return: bb2, unwind: bb12];
} }
bb2: { bb2: {
@ -42,7 +42,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: bb13]; _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12];
} }
bb3: { bb3: {
@ -50,18 +50,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: bb12]; 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: bb13]; drop(_7) -> [return: bb5, unwind: bb12];
} }
bb5: { bb5: {
StorageDead(_7); StorageDead(_7);
drop(_2) -> [return: bb6, unwind: bb14]; drop(_2) -> [return: bb6, unwind: bb13];
} }
bb6: { bb6: {
@ -71,7 +71,7 @@ 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: bb9, unwind: bb11]; drop(_12) -> [return: bb8, unwind: bb10];
} }
bb7: { bb7: {
@ -80,32 +80,28 @@ fn move_out_from_end() -> () {
} }
bb8: { bb8: {
goto -> bb7; StorageDead(_12);
drop(_1) -> [return: bb9, unwind: bb13];
} }
bb9: { bb9: {
StorageDead(_12);
drop(_1) -> [return: bb10, unwind: bb14];
}
bb10: {
StorageDead(_1); StorageDead(_1);
return; return;
} }
bb10 (cleanup): {
drop(_1) -> [return: bb13, unwind terminate(cleanup)];
}
bb11 (cleanup): { bb11 (cleanup): {
drop(_1) -> [return: bb14, unwind terminate(cleanup)]; drop(_7) -> [return: bb12, unwind terminate(cleanup)];
} }
bb12 (cleanup): { bb12 (cleanup): {
drop(_7) -> [return: bb13, unwind terminate(cleanup)]; drop(_2) -> [return: bb13, unwind terminate(cleanup)];
} }
bb13 (cleanup): { bb13 (cleanup): {
drop(_2) -> [return: bb14, unwind terminate(cleanup)];
}
bb14 (cleanup): {
resume; resume;
} }
} }

View file

@ -19,8 +19,4 @@ fn bar(_1: [(Never, u32); 1]) -> u32 {
FakeRead(ForMatchedPlace(None), _1); FakeRead(ForMatchedPlace(None), _1);
unreachable; unreachable;
} }
bb2: {
goto -> bb1;
}
} }

View file

@ -20,7 +20,7 @@ fn main() -> () {
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
_1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb7]; _1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb5];
} }
bb1: { bb1: {
@ -40,7 +40,7 @@ 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: bb4, unwind: bb7]; assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb3, unwind: bb5];
} }
bb2: { bb2: {
@ -49,10 +49,6 @@ fn main() -> () {
} }
bb3: { bb3: {
goto -> bb2;
}
bb4: {
_5 = (_2[_6].0: u64); _5 = (_2[_6].0: u64);
PlaceMention(_5); PlaceMention(_5);
StorageDead(_6); StorageDead(_6);
@ -62,16 +58,12 @@ fn main() -> () {
return; return;
} }
bb5: { bb4: {
FakeRead(ForMatchedPlace(None), _5); FakeRead(ForMatchedPlace(None), _5);
unreachable; unreachable;
} }
bb6: { bb5 (cleanup): {
goto -> bb5;
}
bb7 (cleanup): {
resume; resume;
} }
} }

View file

@ -6,15 +6,11 @@ fn f(_1: Void) -> ! {
bb0: { bb0: {
PlaceMention(_1); PlaceMention(_1);
goto -> bb1;
}
bb1: {
FakeRead(ForMatchedPlace(None), _1); FakeRead(ForMatchedPlace(None), _1);
unreachable; unreachable;
} }
bb2: { bb1: {
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: bb5]; _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb4];
} }
bb1: { bb1: {
@ -20,7 +20,7 @@ fn bar(_1: Box<[T]>) -> () {
PlaceMention((*_2)); PlaceMention((*_2));
StorageDead(_2); StorageDead(_2);
_0 = const (); _0 = const ();
drop(_1) -> [return: bb4, unwind: bb6]; drop(_1) -> [return: bb3, unwind: bb5];
} }
bb2: { bb2: {
@ -29,18 +29,14 @@ fn bar(_1: Box<[T]>) -> () {
} }
bb3: { bb3: {
goto -> bb2;
}
bb4: {
return; return;
} }
bb5 (cleanup): { bb4 (cleanup): {
drop(_1) -> [return: bb6, unwind terminate(cleanup)]; drop(_1) -> [return: bb5, unwind terminate(cleanup)];
} }
bb6 (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: bb4]; _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb3];
} }
bb1: { bb1: {
@ -32,11 +32,7 @@ fn hey(_1: &[T]) -> () {
unreachable; unreachable;
} }
bb3: { bb3 (cleanup): {
goto -> bb2;
}
bb4 (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: bb25]; _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb23];
} }
bb1: { bb1: {
@ -91,7 +91,7 @@ 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: bb4, unwind: bb25]; _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23];
} }
bb2: { bb2: {
@ -100,24 +100,20 @@ fn main() -> () {
} }
bb3: { bb3: {
goto -> bb2; switchInt(move _10) -> [0: bb5, otherwise: bb4];
} }
bb4: { bb4: {
switchInt(move _10) -> [0: bb6, otherwise: bb5]; StorageDead(_12);
StorageDead(_11);
goto -> bb9;
} }
bb5: { bb5: {
StorageDead(_12); goto -> bb6;
StorageDead(_11);
goto -> bb10;
} }
bb6: { bb6: {
goto -> bb7;
}
bb7: {
StorageDead(_12); StorageDead(_12);
StorageDead(_11); StorageDead(_11);
StorageLive(_14); StorageLive(_14);
@ -136,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) -> bb25; _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb23;
} }
bb8: { bb7: {
StorageDead(_21); StorageDead(_21);
StorageDead(_19); StorageDead(_19);
StorageDead(_17); StorageDead(_17);
@ -151,23 +147,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb8: {
goto -> bb10;
}
bb9: { bb9: {
goto -> bb11; _1 = const ();
goto -> bb10;
} }
bb10: { bb10: {
_1 = const (); StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb11; goto -> bb11;
} }
bb11: { bb11: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb12;
}
bb12: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
@ -177,10 +173,10 @@ fn main() -> () {
StorageLive(_23); StorageLive(_23);
StorageLive(_24); StorageLive(_24);
StorageLive(_25); StorageLive(_25);
_25 = function_with_bytes::<&*b"AAAA">() -> [return: bb13, unwind: bb25]; _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23];
} }
bb13: { bb12: {
_24 = &_25; _24 = &_25;
StorageLive(_26); StorageLive(_26);
StorageLive(_27); StorageLive(_27);
@ -199,33 +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: bb16, unwind: bb25]; _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23];
} }
bb14: { bb13: {
FakeRead(ForMatchedPlace(None), _23); FakeRead(ForMatchedPlace(None), _23);
unreachable; unreachable;
} }
bb14: {
switchInt(move _30) -> [0: bb16, otherwise: bb15];
}
bb15: { bb15: {
goto -> bb14; StorageDead(_32);
StorageDead(_31);
goto -> bb20;
} }
bb16: { bb16: {
switchInt(move _30) -> [0: bb18, otherwise: bb17]; goto -> bb17;
} }
bb17: { bb17: {
StorageDead(_32);
StorageDead(_31);
goto -> bb22;
}
bb18: {
goto -> bb19;
}
bb19: {
StorageDead(_32); StorageDead(_32);
StorageDead(_31); StorageDead(_31);
StorageLive(_34); StorageLive(_34);
@ -244,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) -> bb25; _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb23;
} }
bb20: { bb18: {
StorageDead(_41); StorageDead(_41);
StorageDead(_39); StorageDead(_39);
StorageDead(_37); StorageDead(_37);
@ -259,23 +251,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb21: { bb19: {
goto -> bb23; goto -> bb21;
} }
bb22: { bb20: {
_22 = const (); _22 = const ();
goto -> bb23; goto -> bb21;
} }
bb23: { bb21: {
StorageDead(_30); StorageDead(_30);
StorageDead(_29); StorageDead(_29);
StorageDead(_28); StorageDead(_28);
goto -> bb24; goto -> bb22;
} }
bb24: { bb22: {
StorageDead(_27); StorageDead(_27);
StorageDead(_25); StorageDead(_25);
StorageDead(_23); StorageDead(_23);
@ -284,7 +276,7 @@ fn main() -> () {
return; return;
} }
bb25 (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: bb25]; _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb23];
} }
bb1: { bb1: {
@ -91,7 +91,7 @@ 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: bb4, unwind: bb25]; _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23];
} }
bb2: { bb2: {
@ -100,24 +100,20 @@ fn main() -> () {
} }
bb3: { bb3: {
goto -> bb2; switchInt(move _10) -> [0: bb5, otherwise: bb4];
} }
bb4: { bb4: {
switchInt(move _10) -> [0: bb6, otherwise: bb5]; StorageDead(_12);
StorageDead(_11);
goto -> bb9;
} }
bb5: { bb5: {
StorageDead(_12); goto -> bb6;
StorageDead(_11);
goto -> bb10;
} }
bb6: { bb6: {
goto -> bb7;
}
bb7: {
StorageDead(_12); StorageDead(_12);
StorageDead(_11); StorageDead(_11);
StorageLive(_14); StorageLive(_14);
@ -136,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) -> bb25; _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb23;
} }
bb8: { bb7: {
StorageDead(_21); StorageDead(_21);
StorageDead(_19); StorageDead(_19);
StorageDead(_17); StorageDead(_17);
@ -151,23 +147,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb8: {
goto -> bb10;
}
bb9: { bb9: {
goto -> bb11; _1 = const ();
goto -> bb10;
} }
bb10: { bb10: {
_1 = const (); StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb11; goto -> bb11;
} }
bb11: { bb11: {
StorageDead(_10);
StorageDead(_9);
StorageDead(_8);
goto -> bb12;
}
bb12: {
StorageDead(_7); StorageDead(_7);
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
@ -177,10 +173,10 @@ fn main() -> () {
StorageLive(_23); StorageLive(_23);
StorageLive(_24); StorageLive(_24);
StorageLive(_25); StorageLive(_25);
_25 = function_with_bytes::<&*b"AAAA">() -> [return: bb13, unwind: bb25]; _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23];
} }
bb13: { bb12: {
_24 = &_25; _24 = &_25;
StorageLive(_26); StorageLive(_26);
StorageLive(_27); StorageLive(_27);
@ -199,33 +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: bb16, unwind: bb25]; _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23];
} }
bb14: { bb13: {
FakeRead(ForMatchedPlace(None), _23); FakeRead(ForMatchedPlace(None), _23);
unreachable; unreachable;
} }
bb14: {
switchInt(move _30) -> [0: bb16, otherwise: bb15];
}
bb15: { bb15: {
goto -> bb14; StorageDead(_32);
StorageDead(_31);
goto -> bb20;
} }
bb16: { bb16: {
switchInt(move _30) -> [0: bb18, otherwise: bb17]; goto -> bb17;
} }
bb17: { bb17: {
StorageDead(_32);
StorageDead(_31);
goto -> bb22;
}
bb18: {
goto -> bb19;
}
bb19: {
StorageDead(_32); StorageDead(_32);
StorageDead(_31); StorageDead(_31);
StorageLive(_34); StorageLive(_34);
@ -244,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) -> bb25; _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb23;
} }
bb20: { bb18: {
StorageDead(_41); StorageDead(_41);
StorageDead(_39); StorageDead(_39);
StorageDead(_37); StorageDead(_37);
@ -259,23 +251,23 @@ fn main() -> () {
unreachable; unreachable;
} }
bb21: { bb19: {
goto -> bb23; goto -> bb21;
} }
bb22: { bb20: {
_22 = const (); _22 = const ();
goto -> bb23; goto -> bb21;
} }
bb23: { bb21: {
StorageDead(_30); StorageDead(_30);
StorageDead(_29); StorageDead(_29);
StorageDead(_28); StorageDead(_28);
goto -> bb24; goto -> bb22;
} }
bb24: { bb22: {
StorageDead(_27); StorageDead(_27);
StorageDead(_25); StorageDead(_25);
StorageDead(_23); StorageDead(_23);
@ -284,7 +276,7 @@ fn main() -> () {
return; return;
} }
bb25 (cleanup): { bb23 (cleanup): {
resume; resume;
} }
} }

View file

@ -18,24 +18,24 @@ fn shortcut_second_or() -> () {
_1 = (move _2, const 0_i32); _1 = (move _2, const 0_i32);
StorageDead(_2); StorageDead(_2);
PlaceMention(_1); PlaceMention(_1);
switchInt(((_1.0: (i32, i32)).0: i32)) -> [0: bb3, otherwise: bb2]; switchInt(((_1.0: (i32, i32)).0: i32)) -> [0: bb2, otherwise: bb1];
} }
bb1: { bb1: {
switchInt(((_1.0: (i32, i32)).1: i32)) -> [1: bb4, otherwise: bb3];
}
bb2: {
switchInt((_1.1: i32)) -> [2: bb5, 3: bb6, otherwise: bb3];
}
bb3: {
_0 = const (); _0 = const ();
goto -> bb14; goto -> bb14;
} }
bb2: {
switchInt(((_1.0: (i32, i32)).1: i32)) -> [1: bb4, otherwise: bb1];
}
bb3: {
switchInt((_1.1: i32)) -> [2: bb5, 3: bb6, otherwise: bb1];
}
bb4: { bb4: {
switchInt((_1.1: i32)) -> [2: bb7, 3: bb8, otherwise: bb1]; switchInt((_1.1: i32)) -> [2: bb7, 3: bb8, otherwise: bb3];
} }
bb5: { bb5: {
@ -43,7 +43,7 @@ fn shortcut_second_or() -> () {
} }
bb6: { bb6: {
falseEdge -> [real: bb11, imaginary: bb2]; falseEdge -> [real: bb11, imaginary: bb1];
} }
bb7: { bb7: {
@ -51,7 +51,7 @@ fn shortcut_second_or() -> () {
} }
bb8: { bb8: {
falseEdge -> [real: bb13, imaginary: bb1]; falseEdge -> [real: bb13, imaginary: bb3];
} }
bb9: { bb9: {