1
Fork 0

Auto merge of #91279 - scottmcm:small-refactor, r=nagisa

Small mir-opt refactor

Hopefully-non-controversial changes from some not-ready-yet work that I'd figured I'd submit on their own.
This commit is contained in:
bors 2021-12-06 13:04:18 +00:00
commit 0fb1c371d4
4 changed files with 11 additions and 23 deletions

View file

@ -33,15 +33,8 @@ impl<'tcx> MirPass<'tcx> for SimplifyConstCondition {
} => {
let constant = c.literal.try_eval_bits(tcx, param_env, switch_ty);
if let Some(constant) = constant {
let otherwise = targets.otherwise();
let mut ret = TerminatorKind::Goto { target: otherwise };
for (v, t) in targets.iter() {
if v == constant {
ret = TerminatorKind::Goto { target: t };
break;
}
}
ret
let target = targets.target_for_value(constant);
TerminatorKind::Goto { target }
} else {
continue;
}