Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve merge_from_succ #68790

Merged
merged 2 commits into from
Feb 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/librustc_passes/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -843,6 +850,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {

if changed {
this.rwu_table.assign_unpacked(idx, rwu);
any_changed = true;
}
});

Expand All @@ -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
Expand Down