Skip to content

Unschedule moved locals - #159577

Draft
cjgillot wants to merge 8 commits into
rust-lang:mainfrom
cjgillot:unschedule-moved-locals
Draft

Unschedule moved locals#159577
cjgillot wants to merge 8 commits into
rust-lang:mainfrom
cjgillot:unschedule-moved-locals

Conversation

@cjgillot

@cjgillot cjgillot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

View all comments

Alternative to #159537

This extracts part of the implementation from #125923.

Instead of maintaining a bit-set of locals that are moved from the innermost scope, this PR just removes the locals from the drop schedule.

r? @ghost for perf, and because of a borrowck corner case

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 19, 2026
@cjgillot

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 19, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 19, 2026
@rust-log-analyzer

This comment has been minimized.

@cjgillot
cjgillot force-pushed the unschedule-moved-locals branch from 53d969a to d9d6173 Compare July 19, 2026 20:40
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ab0430c (ab0430cfc09675383a04ad2a1b7877ec314aaac9)
Base parent: 9f36de7 (9f36de775bc636c8e88c31a173c2bcb6995956a0)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ab0430c): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.4%, 0.5%] 6
Regressions ❌
(secondary)
0.3% [0.2%, 0.3%] 2
Improvements ✅
(primary)
-0.5% [-1.0%, -0.2%] 53
Improvements ✅
(secondary)
-0.4% [-1.0%, -0.2%] 44
All ❌✅ (primary) -0.4% [-1.0%, 0.5%] 59

Max RSS (memory usage)

Results (primary -0.7%, secondary -0.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.9%, -0.5%] 3
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) -0.7% [-0.9%, -0.5%] 3

Cycles

Results (primary -2.3%, secondary -1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.3% [-2.4%, -2.3%] 2
Improvements ✅
(secondary)
-1.4% [-1.4%, -1.4%] 1
All ❌✅ (primary) -2.3% [-2.4%, -2.3%] 2

Binary size

Results (primary -0.4%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.9%, -0.0%] 42
Improvements ✅
(secondary)
-0.2% [-1.9%, -0.0%] 30
All ❌✅ (primary) -0.4% [-1.9%, 0.6%] 43

Bootstrap: 484.26s -> 485.704s (0.30%)
Artifact size: 391.74 MiB -> 391.76 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 19, 2026
@cjgillot

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 20, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 20, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 563ed1f (563ed1fa91907743b81f0cbaac99dc8c8ad29077)
Base parent: 87e5904 (87e5904f5eb6398af6b22eac2802c78934260c48)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (563ed1f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
1.3% [0.2%, 11.7%] 65
Regressions ❌
(secondary)
0.7% [0.1%, 2.0%] 66
Improvements ✅
(primary)
-0.3% [-0.6%, -0.2%] 10
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 2
All ❌✅ (primary) 1.0% [-0.6%, 11.7%] 75

Max RSS (memory usage)

Results (primary 1.7%, secondary 2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
6.9% [6.6%, 7.2%] 2
Regressions ❌
(secondary)
3.2% [2.1%, 6.0%] 4
Improvements ✅
(primary)
-1.7% [-3.5%, -0.8%] 3
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) 1.7% [-3.5%, 7.2%] 5

Cycles

Results (primary 10.9%, secondary -1.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
10.9% [1.9%, 23.2%] 6
Regressions ❌
(secondary)
5.9% [5.9%, 5.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-4.2%, -3.5%] 3
All ❌✅ (primary) 10.9% [1.9%, 23.2%] 6

Binary size

Results (primary -0.4%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.9%, -0.0%] 42
Improvements ✅
(secondary)
-0.2% [-1.9%, -0.0%] 29
All ❌✅ (primary) -0.4% [-1.9%, 0.6%] 43

Bootstrap: 486.983s -> 486.82s (-0.03%)
Artifact size: 391.82 MiB -> 391.79 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 21, 2026
@cjgillot
cjgillot force-pushed the unschedule-moved-locals branch from acb7050 to b5a6304 Compare July 22, 2026 00:41
@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 22, 2026
@cjgillot

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 22, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 22, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 5c95d39 (5c95d397a217a2ad69c501c978c9ec972fb53549)
Base parent: 0e29c21 (0e29c21d93abc9bdc330182be1fbd33cfd5fee68)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5c95d39): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.9% [0.1%, 6.6%] 48
Regressions ❌
(secondary)
0.7% [0.1%, 1.8%] 36
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 12
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.2%] 4
All ❌✅ (primary) 0.6% [-0.6%, 6.6%] 60

Max RSS (memory usage)

Results (primary 1.7%, secondary 1.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.8% [0.4%, 4.7%] 6
Regressions ❌
(secondary)
3.2% [1.4%, 6.6%] 9
Improvements ✅
(primary)
-1.6% [-2.5%, -0.7%] 2
Improvements ✅
(secondary)
-2.9% [-5.1%, -0.8%] 3
All ❌✅ (primary) 1.7% [-2.5%, 4.7%] 8

Cycles

Results (primary 4.9%, secondary 2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.9% [1.2%, 9.9%] 7
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.9% [1.2%, 9.9%] 7

Binary size

Results (primary -0.4%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.6%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-1.9%, -0.0%] 42
Improvements ✅
(secondary)
-0.2% [-1.9%, -0.0%] 29
All ❌✅ (primary) -0.4% [-1.9%, 0.6%] 43

Bootstrap: 495.463s -> 486.653s (-1.78%)
Artifact size: 387.85 MiB -> 387.83 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 22, 2026
@cjgillot
cjgillot force-pushed the unschedule-moved-locals branch 2 times, most recently from c8d01f6 to e226832 Compare August 2, 2026 16:17
@cjgillot

cjgillot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Re-running perf now that #160193 merged.
@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 2, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 2, 2026
@rust-bors

rust-bors Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d28e1ec (d28e1ec2b81d75ad63c3cf87781d7c18de255b0c)
Base parent: b04d3c8 (b04d3c8c22822b7f10dab5a563b4e2afff1861c1)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d28e1ec): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.6% [0.2%, 1.8%] 40
Regressions ❌
(secondary)
0.6% [0.1%, 1.6%] 33
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 10
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-0.6%, 1.8%] 50

Max RSS (memory usage)

Results (primary 1.0%, secondary 0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.4% [0.4%, 2.4%] 4
Regressions ❌
(secondary)
1.8% [0.4%, 6.8%] 9
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-3.6% [-4.4%, -2.7%] 3
All ❌✅ (primary) 1.0% [-0.6%, 2.4%] 5

Cycles

Results (primary -1.2%, secondary -1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [0.5%, 3.4%] 3
Improvements ✅
(primary)
-1.2% [-3.0%, -0.5%] 13
Improvements ✅
(secondary)
-2.5% [-15.5%, -0.4%] 18
All ❌✅ (primary) -1.2% [-3.0%, -0.5%] 13

Binary size

Results (primary -0.3%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.6%] 11
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
-0.3% [-1.9%, -0.0%] 56
Improvements ✅
(secondary)
-0.2% [-1.9%, -0.0%] 31
All ❌✅ (primary) -0.3% [-1.9%, 0.6%] 67

Bootstrap: 491.057s -> 490.667s (-0.08%)
Artifact size: 390.41 MiB -> 391.17 MiB (0.20%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 2, 2026
@rust-bors

This comment has been minimized.

cjgillot and others added 8 commits August 3, 2026 01:51
And some more cases along the way.

We have a specific optimization to avoid generating useless drops, use it.
In particular, aggregate construction are very similar to function calls
for which this is designed.
Co-authored-by: dianne <diannes.gm@gmail.com>
@cjgillot
cjgillot force-pushed the unschedule-moved-locals branch from e226832 to 36708a4 Compare August 3, 2026 03:12
@rust-bors

rust-bors Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #160814) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tidy Area: The tidy tool perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

4 participants