Skip to content

Commit 59e41ed

Browse files
committed
Special-case ReEmpty in expand_node().
This wins 6% on `unicode_normalization`, by avoiding a call to `lub_concrete_regions()` and a `Region` equality test.
1 parent 53e7393 commit 59e41ed

File tree

1 file changed

+9
-1
lines changed
  • src/librustc/infer/lexical_region_resolve

1 file changed

+9
-1
lines changed

src/librustc/infer/lexical_region_resolve/mod.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,21 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
360360
match *b_data {
361361
VarValue::Value(cur_region) => {
362362
// Identical scopes can show up quite often, if the fixed point
363-
// iteration converges slowly, skip them
363+
// iteration converges slowly. Skip them. This is purely an
364+
// optimization.
364365
if let (ReScope(a_scope), ReScope(cur_scope)) = (a_region, cur_region) {
365366
if a_scope == cur_scope {
366367
return false;
367368
}
368369
}
369370

371+
// This is a specialized version of the `lub_concrete_regions`
372+
// check below for a common case, here purely as an
373+
// optimization.
374+
if let ReEmpty = a_region {
375+
return false;
376+
}
377+
370378
let mut lub = self.lub_concrete_regions(a_region, cur_region);
371379
if lub == cur_region {
372380
return false;

0 commit comments

Comments
 (0)