In functions with lots of region constraint, if the fixed point
iteration converges only slowly, a lot of the var/var constraints will
have equal regions most of the time. Yet, we still perform the LUB
calculation and try to intern the result. Especially the latter incurs
quite some overhead.
This reduces the take taken by the item bodies checking pass for the
unicode_normalization crate by about 75%.
fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
let tcx = self.tcx();
+
+ // Equal scopes can show up quite often, if the fixed point
+ // iteration converges slowly, skip them
+ if a == b {
+ return a;
+ }
+
match (a, b) {
(&ty::ReClosureBound(..), _)
| (_, &ty::ReClosureBound(..))