Skip to content

Apply RemoveNoopLandingPads post-monomorphization #143208

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mark-Simulacrum
Copy link
Member

@Mark-Simulacrum Mark-Simulacrum commented Jun 29, 2025

On cargo this cuts ~5% of the LLVM IR lines we generate (measured with -Cno-prepopulate-passes).

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 29, 2025
@Mark-Simulacrum
Copy link
Member Author

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 29, 2025

⌛ Trying commit e0423d5 with merge fb9de75

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 29, 2025
Remove no-op cleanups as post-mono MIR opt

On cargo this cuts ~5% of the LLVM IR lines we generate (measured with -Cno-prepopulate-passes). Opening to assess performance.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 29, 2025
@rust-bors

This comment was marked as resolved.

@rust-timer

This comment has been minimized.

@rust-timer

This comment was marked as outdated.

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 29, 2025
@Mark-Simulacrum

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

@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 1, 2025
@rust-timer

This comment has been minimized.

@Mark-Simulacrum

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

rust-bors bot added a commit that referenced this pull request Jul 1, 2025
Remove no-op cleanups as post-mono MIR opt

On cargo this cuts ~5% of the LLVM IR lines we generate (measured with -Cno-prepopulate-passes). Opening to assess performance.
@rust-bors

This comment was marked as resolved.

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e3a4b05): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.4% [0.4%, 0.4%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.0% [-4.6%, -0.2%] 22
Improvements ✅
(secondary)
-2.8% [-18.0%, -0.8%] 17
All ❌✅ (primary) -1.9% [-4.6%, 0.4%] 23

Max RSS (memory usage)

Results (primary -2.6%, secondary -1.3%)

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.6% [-3.8%, -1.2%] 6
Improvements ✅
(secondary)
-1.3% [-2.8%, -0.5%] 3
All ❌✅ (primary) -2.6% [-3.8%, -1.2%] 6

Cycles

Results (primary -2.4%, secondary -2.8%)

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

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
3.2% [0.8%, 7.1%] 4
Improvements ✅
(primary)
-2.6% [-4.3%, -1.2%] 22
Improvements ✅
(secondary)
-5.0% [-20.0%, -0.5%] 11
All ❌✅ (primary) -2.4% [-4.3%, 1.1%] 23

Binary size

Results (primary -0.6%, secondary -0.8%)

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.6% [-1.4%, -0.0%] 66
Improvements ✅
(secondary)
-0.8% [-3.6%, -0.0%] 30
All ❌✅ (primary) -0.6% [-1.4%, -0.0%] 66

Bootstrap: 461.485s -> 461.37s (-0.02%)
Artifact size: 372.20 MiB -> 371.78 MiB (-0.11%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Jul 1, 2025
@Mark-Simulacrum

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

@Mark-Simulacrum

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

@Mark-Simulacrum

This comment was marked as resolved.

@rustbot

This comment was marked as resolved.

@petrochenkov

This comment was marked as resolved.

@rustbot rustbot assigned oli-obk and unassigned petrochenkov Jul 2, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Jul 2, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 2, 2025

📌 Commit 676eed3 has been approved by oli-obk

It is now in the queue for this repository.

@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 Jul 2, 2025
@cjgillot
Copy link
Contributor

cjgillot commented Jul 2, 2025

Is there an opportunity to reuse code from RemoveNoopLandingPads MIR pass?

@RalfJung
Copy link
Member

RalfJung commented Jul 2, 2025

Given that comments and variable names don't line up, seems better to
@bors r-

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 2, 2025
@rustbot

This comment was marked as resolved.

@Mark-Simulacrum
Copy link
Member Author

@bors2 try @rust-timer queue

This is essentially a re-write with @cjgillot's excellent suggestion to reuse the analysis in RemoveNoopLandingPads. Also adjusted some of the naming per @RalfJung's comments -- I'm not perfectly happy with the names, some of this is sort of quasi-true (e.g., reachable is only accurate if you apply the right filters while you traverse the MIR, since we currently can't edit it in-place).

@rust-timer

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

rust-bors bot added a commit that referenced this pull request Jul 3, 2025
Remove no-op cleanups as post-mono MIR opt

On cargo this cuts ~5% of the LLVM IR lines we generate (measured with -Cno-prepopulate-passes). Opening to assess performance.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 3, 2025
@rust-log-analyzer

This comment has been minimized.

This speeds up LLVM and improves codegen overall. As an example, for
cargo this cuts ~5% of the LLVM IR lines we generate (measured with
-Cno-prepopulate-passes).
@rust-bors

This comment was marked as resolved.

@rust-timer

This comment has been minimized.

@Mark-Simulacrum Mark-Simulacrum changed the title Remove no-op cleanups as post-mono MIR opt Jul 3, 2025
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d12ed3f): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-5.1%, -0.2%] 28
Improvements ✅
(secondary)
-3.2% [-18.1%, -0.4%] 19
All ❌✅ (primary) -2.1% [-5.1%, -0.2%] 28

Max RSS (memory usage)

Results (primary -2.0%, 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)
3.4% [2.6%, 4.2%] 2
Regressions ❌
(secondary)
2.4% [0.7%, 4.1%] 2
Improvements ✅
(primary)
-4.2% [-5.6%, -3.4%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.0% [-5.6%, 4.2%] 7

Cycles

Results (primary -2.6%, secondary -4.8%)

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

mean range count
Regressions ❌
(primary)
3.0% [2.1%, 3.8%] 2
Regressions ❌
(secondary)
0.7% [0.7%, 0.7%] 1
Improvements ✅
(primary)
-3.2% [-5.6%, -1.5%] 18
Improvements ✅
(secondary)
-5.2% [-19.9%, -2.0%] 14
All ❌✅ (primary) -2.6% [-5.6%, 3.8%] 20

Binary size

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

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% [-1.4%, -0.0%] 67
Improvements ✅
(secondary)
-1.1% [-3.7%, -0.0%] 30
All ❌✅ (primary) -0.7% [-1.4%, -0.0%] 67

Bootstrap: 461.735s -> 459.425s (-0.50%)
Artifact size: 372.23 MiB -> 372.22 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 3, 2025
@Kobzol
Copy link
Member

Kobzol commented Jul 3, 2025

Awesome wins! I wonder why it only works for debug - is it some interaction with -Zshare-generics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
10 participants