Skip to content

Commit

Permalink
don't walk MIR if no local variables need liveness
Browse files Browse the repository at this point in the history
This is true for tuple-stress and html5ever
  • Loading branch information
nikomatsakis committed Aug 10, 2018
1 parent 1bae4f5 commit ff7f6d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -86,6 +86,11 @@ impl NllLivenessMap {
to_local,
}
}

/// True if there are no local variables that need liveness computation.
crate fn is_empty(&self) -> bool {
self.to_local.is_empty()
}
}

/// Index given to each local variable whose type contains a region.
Expand Down
Expand Up @@ -55,7 +55,7 @@ pub(super) fn generate<'gcx, 'tcx>(
let liveness = LivenessResults::compute(mir, &liveness_map);

// For everything else, it is only live where it is actually used.
{
if !liveness_map.is_empty() {
let mut generator = TypeLivenessGenerator {
cx,
mir,
Expand Down

0 comments on commit ff7f6d5

Please sign in to comment.