diff options
| author | bors <bors@rust-lang.org> | 2021-12-04 05:59:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-04 05:59:16 +0000 |
| commit | 887999d163bace7e79370b952bdd1f930ff4cdd5 (patch) | |
| tree | 0b2a5642dfe49a0cebe9744394169acebf412ccc /compiler/rustc_mir_transform/src/inline.rs | |
| parent | f5815727786aa1ed2793af05cf65c5d79c290c67 (diff) | |
| parent | 3dbb621c72e57c7eee9c10f20316d76c59168f83 (diff) | |
| download | rust-887999d163bace7e79370b952bdd1f930ff4cdd5.tar.gz rust-887999d163bace7e79370b952bdd1f930ff4cdd5.zip | |
Auto merge of #88439 - cynecx:unwind_asm, r=Amanieu
Unwinding support for inline assembly r? `@Amanieu`
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 84a1e3fb600..4dacd4c288a 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -441,6 +441,13 @@ impl Inliner<'tcx> { } } TerminatorKind::Resume => cost += RESUME_PENALTY, + TerminatorKind::InlineAsm { cleanup, .. } => { + cost += INSTR_COST; + + if cleanup.is_some() { + cost += LANDINGPAD_PENALTY; + } + } _ => cost += INSTR_COST, } @@ -954,9 +961,13 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { { bug!("False unwinds should have been removed before inlining") } - TerminatorKind::InlineAsm { ref mut destination, .. } => { + TerminatorKind::InlineAsm { ref mut destination, ref mut cleanup, .. } => { if let Some(ref mut tgt) = *destination { *tgt = self.map_block(*tgt); + } else if !self.in_cleanup_block { + // Unless this inline asm is in a cleanup block, add an unwind edge to + // the original call's cleanup block + *cleanup = self.cleanup_block; } } } |
