Skip to content

Add method to mutate MIR body without invalidating CFG caches. #98872

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 1 commit into from
Jul 5, 2022

Conversation

JakobDegen
Copy link
Contributor

In addition to adding this method, a handful of passes are updated to use it. There's still quite a few passes that could in principle make use of this as well, but do not at the moment because they use VisitorMut or MirPatch, which needs additional support for this.

The method name is slightly unwieldy, but I don't expect anyone to be writing it a lot, and at least it says what it does. If anyone has a suggestion for a better name though, would be happy to rename.

r? rust-lang/mir-opt

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 4, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 4, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 4, 2022

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@JakobDegen
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 4, 2022
@bors
Copy link
Collaborator

bors commented Jul 4, 2022

⌛ Trying commit 0cc53d1ad4d9fe002cc60f55a0058c7922cea639 with merge 288060dc5bda3ac11d03998f2d42202a80596aff...

@bors
Copy link
Collaborator

bors commented Jul 4, 2022

💔 Test failed - checks-actions

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2022
@rust-log-analyzer

This comment has been minimized.

In addition to adding this method, a handful of passes are updated to use it.
@JakobDegen
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Collaborator

bors commented Jul 4, 2022

⌛ Trying commit 26d153a with merge 356ef6e2adccd833be79310a8122a12851aca487...

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

Implementation looks good, r=me if you want to land this

@bors
Copy link
Collaborator

bors commented Jul 4, 2022

☀️ Try build successful - checks-actions
Build commit: 356ef6e2adccd833be79310a8122a12851aca487 (356ef6e2adccd833be79310a8122a12851aca487)

@rust-timer
Copy link
Collaborator

Queued 356ef6e2adccd833be79310a8122a12851aca487 with parent a5c6a48, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (356ef6e2adccd833be79310a8122a12851aca487): comparison url.

Instruction count

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
0.5% 0.9% 15
Regressions 😿
(secondary)
1.2% 2.4% 16
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 0.5% 0.9% 15

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions 😿
(primary)
2.3% 2.3% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 2.3% 2.3% 1

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.0% 4.4% 9
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 4, 2022
@JakobDegen
Copy link
Contributor Author

The cause of the regressions here is that parse_tt got slower, likely LLVM noise. The change itself doesn't seem to make too much of a difference for now, but it does matter at least somewhat in my destprop PR. Also, it's possible that this be more useful if this was applied in more places, so it seems like a principled thing to have in any case.

So yeah, I think it probably makes sense to land this. Could someone r=?

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 4, 2022

📌 Commit 26d153a has been approved by davidtwco

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 4, 2022
@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 4, 2022
@bors
Copy link
Collaborator

bors commented Jul 5, 2022

⌛ Testing commit 26d153a with merge 880646c...

@bors
Copy link
Collaborator

bors commented Jul 5, 2022

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 880646c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 5, 2022
@bors bors merged commit 880646c into rust-lang:master Jul 5, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 5, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (880646c): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
0.1% 0.1% 1
Regressions 😿
(secondary)
2.2% 2.2% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 0.1% 0.1% 1

Cycles

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
2.9% 2.9% 1
Regressions 😿
(secondary)
3.0% 3.2% 2
Improvements 🎉
(primary)
-2.3% -2.3% 1
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 0.3% 2.9% 2

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@rustbot rustbot removed the perf-regression Performance regression. label Jul 5, 2022
@JakobDegen JakobDegen deleted the no-invalidate branch July 8, 2022 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants