Skip to content

Commit

Permalink
Special-case ReEmpty in expand_node().
Browse files Browse the repository at this point in the history
This wins 6% on `unicode_normalization`, by avoiding a call to
`lub_concrete_regions()` and a `Region` equality test.
  • Loading branch information
nnethercote committed Oct 10, 2019
1 parent 53e7393 commit 59e41ed
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/librustc/infer/lexical_region_resolve/mod.rs
Expand Up @@ -360,13 +360,21 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
match *b_data {
VarValue::Value(cur_region) => {
// Identical scopes can show up quite often, if the fixed point
// iteration converges slowly, skip them
// iteration converges slowly. Skip them. This is purely an
// optimization.
if let (ReScope(a_scope), ReScope(cur_scope)) = (a_region, cur_region) {
if a_scope == cur_scope {
return false;
}
}

// This is a specialized version of the `lub_concrete_regions`
// check below for a common case, here purely as an
// optimization.
if let ReEmpty = a_region {
return false;
}

let mut lub = self.lub_concrete_regions(a_region, cur_region);
if lub == cur_region {
return false;
Expand Down

0 comments on commit 59e41ed

Please sign in to comment.