forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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 rust-lang#117359 - tmiasko:call-def, r=cjgillot
Fix def-use check for call terminators Fixes rust-lang#117331.
- Loading branch information
Showing
4 changed files
with
93 additions
and
30 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Regression test for issue #117331, where variable `a` was misidentified as | ||
// being in SSA form (the definition occurs on the return edge only). | ||
// | ||
// edition:2021 | ||
// compile-flags: --crate-type=lib | ||
// build-pass | ||
// needs-unwind | ||
#![feature(custom_mir, core_intrinsics)] | ||
use core::intrinsics::mir::*; | ||
|
||
#[custom_mir(dialect = "runtime", phase = "optimized")] | ||
pub fn f() -> u32 { | ||
mir!( | ||
let a: u32; | ||
{ | ||
Call(a = g(), bb1, UnwindCleanup(bb2)) | ||
} | ||
bb1 = { | ||
RET = a; | ||
Return() | ||
} | ||
bb2 (cleanup) = { | ||
RET = a; | ||
UnwindResume() | ||
} | ||
) | ||
} | ||
|
||
#[inline(never)] | ||
pub fn g() -> u32 { 0 } |