Skip to content

Commit

Permalink
Add a workaround for the TailDuplicator compile time overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
DianQK committed Feb 28, 2024
1 parent 34f2672 commit 51cb2bc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching {
let mut targets = targets.clone();
if replace_otherwise_to_unreachable {
let otherwise_is_last_variant = !allowed_variants.is_empty();
if otherwise_is_last_variant {
// After resolving https://github.com/llvm/llvm-project/issues/78578, we can remove the limit on the number of successors.
if otherwise_is_last_variant
&& !body.basic_blocks[targets.otherwise()]
.terminator()
.successors()
.any(|bb| body.basic_blocks[bb].terminator().successors().count() >= 8)
{
#[allow(rustc::potential_query_instability)]
let last_variant = *allowed_variants.iter().next().unwrap();
targets.add_target(last_variant, targets.otherwise());
Expand Down

0 comments on commit 51cb2bc

Please sign in to comment.