Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
don't walk MIR if no local variables need liveness
This is true for tuple-stress and html5ever
  • Loading branch information
nikomatsakis committed Aug 10, 2018
commit ff7f6d57de1112805272bae57ff5918d4f25e0ab
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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