-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #97103 - luqmana:asm-unwind-cleanup, r=Amanieu,tmiasko
Update MIR passes to handle unwinding Inline Asm Some more follow up fixes from #95864 (comment) r? `@Amanieu`
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/test/mir-opt/asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// MIR for `main` after AbortUnwindingCalls | ||
|
||
fn main() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/asm_unwind_panic_abort.rs:12:11: 12:11 | ||
let _1: (); // in scope 0 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49 | ||
scope 1 { | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49 | ||
_1 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49 | ||
asm!("", options(MAY_UNWIND)) -> [return: bb1, unwind: bb2]; // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:9: 14:49 | ||
} | ||
|
||
bb1: { | ||
StorageDead(_1); // scope 1 at $DIR/asm_unwind_panic_abort.rs:14:48: 14:49 | ||
_0 = const (); // scope 1 at $DIR/asm_unwind_panic_abort.rs:13:5: 15:6 | ||
return; // scope 0 at $DIR/asm_unwind_panic_abort.rs:16:2: 16:2 | ||
} | ||
|
||
bb2 (cleanup): { | ||
abort; // scope 0 at $DIR/asm_unwind_panic_abort.rs:12:1: 16:2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//! Tests that unwinding from an asm block is caught and forced to abort | ||
//! when `-C panic=abort`. | ||
|
||
// min-llvm-version: 13.0.0 | ||
// only-x86_64 | ||
// compile-flags: -C panic=abort | ||
// no-prefer-dynamic | ||
|
||
#![feature(asm_unwind)] | ||
|
||
// EMIT_MIR asm_unwind_panic_abort.main.AbortUnwindingCalls.after.mir | ||
fn main() { | ||
unsafe { | ||
std::arch::asm!("", options(may_unwind)); | ||
} | ||
} |