Skip to content

NLL: Walk the MIR only once for the "unused mut" lint #51660

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

Merged
merged 2 commits into from
Jun 22, 2018

Conversation

lqd
Copy link
Member

@lqd lqd commented Jun 20, 2018

Turns the quadratic loop gathering local variable assignments into a single MIR walk, and brings down the number of super_mir calls generated from do_mir_borrowck to the expected levels seen in nll::replace_regions_in_mir and nll::compute_regions, i.e. on clap: 1883 super_mir calls instead of 8011.

The limited perf numbers I could gather on my machines look to be what we expected: clap-check seems to be gaining back a lot of the 7% we previously saw in visit_mir.

Fixes #51641.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 20, 2018
@Mark-Simulacrum
Copy link
Member

@bors try

@bors
Copy link
Collaborator

bors commented Jun 20, 2018

⌛ Trying commit 7154383 with merge 737c5cc...

bors added a commit that referenced this pull request Jun 20, 2018
NLL: Walk the MIR only once for the "unused mut" lint

Turns the quadratic loop gathering local variable assignments into a single MIR walk, and brings down the number of `super_mir` calls generated from `do_mir_borrowck` to the expected levels seen in `nll::replace_regions_in_mir` and `nll::compute_regions`, i.e. on clap: 1883 `super_mir` calls instead of 8011.

The limited perf numbers I could gather on my machines look to be what we expected: `clap-check` seems to be gaining back a lot of the 7% we previously saw in `visit_mir`.

Fixes #51641.

r? @nikomatsakis
}

match place_context {
PlaceContext::Store | PlaceContext::Call => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should factor this out to share code with the find_assignments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically just make a fn that returns a bool

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe share code with this function?

pub fn categorize<'tcx>(context: PlaceContext<'tcx>, mode: LivenessMode) -> Option<DefUse> {

@kennytm kennytm added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 20, 2018
@bors
Copy link
Collaborator

bors commented Jun 20, 2018

☀️ Test successful - status-travis
State: approved= try=True

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 21, 2018
@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 21, 2018
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 21, 2018

📌 Commit 63a4e72 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 21, 2018
@bors
Copy link
Collaborator

bors commented Jun 22, 2018

⌛ Testing commit 63a4e72 with merge 16063f00f7b8a253cb2f15c4e405a402a997cb43...

@bors
Copy link
Collaborator

bors commented Jun 22, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 22, 2018
@rust-highfive

This comment has been minimized.

1 similar comment
@rust-highfive

This comment has been minimized.

@lqd
Copy link
Member Author

lqd commented Jun 22, 2018

@kennytm the failures look like CI network issues right ?

@kennytm
Copy link
Member

kennytm commented Jun 22, 2018

@bors retry travis-ci/travis-ci#9696

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 22, 2018
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 22, 2018
@bors
Copy link
Collaborator

bors commented Jun 22, 2018

⌛ Testing commit 63a4e72 with merge e70ff68...

bors added a commit that referenced this pull request Jun 22, 2018
NLL: Walk the MIR only once for the "unused mut" lint

Turns the quadratic loop gathering local variable assignments into a single MIR walk, and brings down the number of `super_mir` calls generated from `do_mir_borrowck` to the expected levels seen in `nll::replace_regions_in_mir` and `nll::compute_regions`, i.e. on clap: 1883 `super_mir` calls instead of 8011.

The limited perf numbers I could gather on my machines look to be what we expected: `clap-check` seems to be gaining back a lot of the 7% we previously saw in `visit_mir`.

Fixes #51641.

r? @nikomatsakis
@bors
Copy link
Collaborator

bors commented Jun 22, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing e70ff68 to master...

@bors bors merged commit 63a4e72 into rust-lang:master Jun 22, 2018
@lqd lqd deleted the the-MIRnistry-of-walks branch June 22, 2018 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants