-
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.
Update the test case for
SimplifyCfg-after-unreachable-enum-branching
- Loading branch information
Showing
3 changed files
with
67 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//@ unit-test: SimplifyCfg-after-unreachable-enum-branching | ||
#![feature(custom_mir, core_intrinsics)] | ||
#![crate_type = "lib"] | ||
|
||
use std::intrinsics::mir::*; | ||
|
||
// Check that we correctly cleaned up the dead BB. | ||
// EMIT_MIR simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff | ||
#[custom_mir(dialect = "runtime", phase = "post-cleanup")] | ||
pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { | ||
// CHECK-LABEL: fn assert_nonzero_nonmax( | ||
// CHECK: bb0: { | ||
// CHECK-NEXT: switchInt({{.*}}) -> [0: [[unreachable:bb.*]], 1: [[retblock2:bb.*]], 255: [[unreachable:bb.*]], otherwise: [[retblock:bb.*]]]; | ||
// CHECK-NEXT: } | ||
// CHECK-NOT: _0 = const 1_u8; | ||
// CHECK: [[retblock2]]: { | ||
// CHECK-NEXT: _0 = const 2_u8; | ||
// CHECK-NEXT: return; | ||
// CHECK-NEXT: } | ||
// CHECK: [[unreachable]]: { | ||
// CHECK-NEXT: unreachable; | ||
// CHECK-NEXT: } | ||
// CHECK: [[retblock]]: { | ||
// CHECK-NEXT: _0 = _1; | ||
// CHECK-NEXT: return; | ||
// CHECK-NEXT: } | ||
mir!( | ||
{ | ||
match x { | ||
0 => unreachable, | ||
1 => retblock2, | ||
u8::MAX => unreachable, | ||
_ => retblock, | ||
} | ||
} | ||
deadRetblock1 = { | ||
RET = 1; | ||
Return() | ||
} | ||
retblock2 = { | ||
RET = 2; | ||
Return() | ||
} | ||
unreachable = { | ||
Unreachable() | ||
} | ||
retblock = { | ||
RET = x; | ||
Return() | ||
} | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.