diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-10-10 13:06:12 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-10-10 16:21:37 +1100 |
| commit | 59e41edcc15ed07de604c61876ea091900f73649 (patch) | |
| tree | 8d468dcaed71a2b30e1a33b30a982f2b50d38295 | |
| parent | 53e739305a34ed42198b5f595fa549223a29814d (diff) | |
| download | rust-59e41edcc15ed07de604c61876ea091900f73649.tar.gz rust-59e41edcc15ed07de604c61876ea091900f73649.zip | |
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.
| -rw-r--r-- | src/librustc/infer/lexical_region_resolve/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 84960d149d0..94ec3b981a4 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -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; |
