Rollup merge of #68790 - nnethercote:improve-merge_from_succ, r=nikomatsakis

Improve `merge_from_succ`

A couple of small performance wins.

r? @nikomatsakis
This commit is contained in:
Dylan DPC 2020-02-05 13:14:25 +01:00 committed by GitHub
commit c1779412fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -822,8 +822,15 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
return false;
}
let mut changed = false;
let mut any_changed = false;
self.indices2(ln, succ_ln, |this, idx, succ_idx| {
// This is a special case, pulled out from the code below, where we
// don't have to do anything. It occurs about 60-70% of the time.
if this.rwu_table.packed_rwus[succ_idx] == INV_INV_FALSE {
return;
}
let mut changed = false;
let mut rwu = this.rwu_table.get(idx);
let succ_rwu = this.rwu_table.get(succ_idx);
if succ_rwu.reader.is_valid() && !rwu.reader.is_valid() {
@ -843,6 +850,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
if changed {
this.rwu_table.assign_unpacked(idx, rwu);
any_changed = true;
}
});
@ -851,9 +859,9 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
ln,
self.ln_str(succ_ln),
first_merge,
changed
any_changed
);
return changed;
return any_changed;
}
// Indicates that a local variable was *defined*; we know that no