1
Fork 0

Optimize plug_leaks.

This commit avoids the `fold_regions` call in `plug_leaks` when
`skol_map` is empty, which is the common case. This gives speed-ups of
up to 1.14x on some of the rustc-benchmarks.
This commit is contained in:
Nicholas Nethercote 2016-09-29 20:34:28 +10:00
parent 8ccfc695b5
commit 1fece3d84b

View file

@ -756,6 +756,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
skol_map,
value);
if skol_map.is_empty() {
return self.resolve_type_vars_if_possible(value);
}
// Compute a mapping from the "taint set" of each skolemized
// region back to the `ty::BoundRegion` that it originally
// represented. Because `leak_check` passed, we know that
@ -813,9 +817,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
});
debug!("plug_leaks: result={:?}",
result);
self.pop_skolemized(skol_map, snapshot);
debug!("plug_leaks: result={:?}", result);