Try enabling MatchBranchSimplification
This commit is contained in:
parent
917b0b6c70
commit
7e04c93493
5 changed files with 50 additions and 7 deletions
|
@ -41,7 +41,7 @@ pub struct MatchBranchSimplification;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||
sess.mir_opt_level() >= 3
|
||||
sess.mir_opt_level() >= 1
|
||||
}
|
||||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -62,7 +62,12 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
|||
..
|
||||
} if targets.iter().len() == 1 => {
|
||||
let (value, target) = targets.iter().next().unwrap();
|
||||
if target == targets.otherwise() {
|
||||
// We require that this block and the two possible target blocks all be
|
||||
// distinct.
|
||||
if target == targets.otherwise()
|
||||
|| bb_idx == target
|
||||
|| bb_idx == targets.otherwise()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
(discr, value, target, targets.otherwise())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue