Remove restrictions on small enum statements such as Order
, Option
or Result
`early-tailduplication` is only a problem when there are a significant number of branches.
This commit is contained in:
parent
f8656ef6e9
commit
102bda49b1
1 changed files with 4 additions and 1 deletions
|
@ -175,7 +175,10 @@ impl<'tcx> MirPass<'tcx> for UnreachableEnumBranching {
|
|||
// ```
|
||||
let otherwise_is_last_variant = !otherwise_is_empty_unreachable
|
||||
&& allowed_variants.len() == 1
|
||||
&& check_successors(&body.basic_blocks, targets.otherwise());
|
||||
// Despite the LLVM issue, we hope that small enum can still be transformed.
|
||||
// This is valuable for both `a <= b` and `if let Some/Ok(v)`.
|
||||
&& (targets.all_targets().len() <= 3
|
||||
|| check_successors(&body.basic_blocks, targets.otherwise()));
|
||||
let replace_otherwise_to_unreachable = otherwise_is_last_variant
|
||||
|| (!otherwise_is_empty_unreachable && allowed_variants.is_empty());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue