-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
148 additions
and
75 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
25 changes: 25 additions & 0 deletions
25
...nreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff
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,25 @@ | ||
- // MIR for `assert_nonzero_nonmax` before SimplifyCfg-after-uninhabited-enum-branching | ||
+ // MIR for `assert_nonzero_nonmax` after SimplifyCfg-after-uninhabited-enum-branching | ||
|
||
fn assert_nonzero_nonmax(_1: u8) -> u8 { | ||
let mut _0: u8; // return place in scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+0:47: +0:49 | ||
|
||
bb0: { | ||
- switchInt(_1) -> [0: bb1, 255: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+3:13: +7:14 | ||
+ switchInt(_1) -> [0: bb1, 255: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+3:13: +7:14 | ||
} | ||
|
||
bb1: { | ||
unreachable; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+10:13: +10:26 | ||
} | ||
|
||
bb2: { | ||
- unreachable; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+13:13: +13:26 | ||
- } | ||
- | ||
- bb3: { | ||
_0 = _1; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+16:13: +16:20 | ||
return; // scope 0 at $DIR/simplify_duplicate_unreachable_blocks.rs:+17:13: +17:21 | ||
} | ||
} | ||
|
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 @@ | ||
#![feature(custom_mir, core_intrinsics)] | ||
#![crate_type = "lib"] | ||
|
||
use std::intrinsics::mir::*; | ||
|
||
// unit-test: SimplifyCfg-after-uninhabited-enum-branching | ||
|
||
// EMIT_MIR simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff | ||
#[custom_mir(dialect = "runtime", phase = "post-cleanup")] | ||
pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { | ||
mir!( | ||
{ | ||
match x { | ||
0 => unreachable1, | ||
u8::MAX => unreachable2, | ||
_ => retblock, | ||
} | ||
} | ||
unreachable1 = { | ||
Unreachable() | ||
} | ||
unreachable2 = { | ||
Unreachable() | ||
} | ||
retblock = { | ||
RET = x; | ||
Return() | ||
} | ||
) | ||
} |
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
Oops, something went wrong.