mir: require is_cleanup
when creating BasicBlockData
This commit is contained in:
parent
15fa788cc3
commit
93aea1d0fe
7 changed files with 30 additions and 25 deletions
|
@ -179,15 +179,17 @@ impl<'tcx> crate::MirPass<'tcx> for EarlyOtherwiseBranch {
|
|||
let eq_targets = SwitchTargets::new(eq_new_targets, parent_targets.otherwise());
|
||||
|
||||
// Create `bbEq` in example above
|
||||
let mut eq_switch = BasicBlockData::new(Some(Terminator {
|
||||
source_info: bbs[parent].terminator().source_info,
|
||||
kind: TerminatorKind::SwitchInt {
|
||||
// switch on the first discriminant, so we can mark the second one as dead
|
||||
discr: parent_op,
|
||||
targets: eq_targets,
|
||||
},
|
||||
}));
|
||||
eq_switch.is_cleanup = bbs[parent].is_cleanup;
|
||||
let eq_switch = BasicBlockData::new(
|
||||
Some(Terminator {
|
||||
source_info: bbs[parent].terminator().source_info,
|
||||
kind: TerminatorKind::SwitchInt {
|
||||
// switch on the first discriminant, so we can mark the second one as dead
|
||||
discr: parent_op,
|
||||
targets: eq_targets,
|
||||
},
|
||||
}),
|
||||
bbs[parent].is_cleanup,
|
||||
);
|
||||
|
||||
let eq_bb = patch.new_block(eq_switch);
|
||||
|
||||
|
|
|
@ -572,11 +572,13 @@ impl<'tcx> Inliner<'tcx> {
|
|||
let return_block = if let Some(block) = target {
|
||||
// Prepare a new block for code that should execute when call returns. We don't use
|
||||
// target block directly since it might have other predecessors.
|
||||
let mut data = BasicBlockData::new(Some(Terminator {
|
||||
source_info: terminator.source_info,
|
||||
kind: TerminatorKind::Goto { target: block },
|
||||
}));
|
||||
data.is_cleanup = caller_body[block].is_cleanup;
|
||||
let data = BasicBlockData::new(
|
||||
Some(Terminator {
|
||||
source_info: terminator.source_info,
|
||||
kind: TerminatorKind::Goto { target: block },
|
||||
}),
|
||||
caller_body[block].is_cleanup,
|
||||
);
|
||||
Some(caller_body.basic_blocks_mut().push(data))
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -96,7 +96,7 @@ impl<'tcx> AsyncDestructorCtorShimBuilder<'tcx> {
|
|||
typing_env,
|
||||
|
||||
stack: Vec::with_capacity(Self::MAX_STACK_LEN),
|
||||
last_bb: bbs.push(BasicBlockData::new(None)),
|
||||
last_bb: bbs.push(BasicBlockData::new(None, false)),
|
||||
top_cleanup_bb: match tcx.sess.panic_strategy() {
|
||||
PanicStrategy::Unwind => {
|
||||
// Don't drop input arg because it's just a pointer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue