Skip to content

Skip no-op drop glue #142508

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 2 commits into
base: master
Choose a base branch
from

Conversation

Mark-Simulacrum
Copy link
Member

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

Since #122662 this no longer gets used in vtables, so we're safe to fully
drop generating these empty functions. Those are eventually cleaned up
by LLVM, but it's wasteful to produce them in the first place.

This doesn't appear to be a significant win (and shows some slight regressions) but
seems like the right thing to do. At minimum it reduces noise in the LLVM IR we generate,
which seems like a good thing.

Since 122662 this no longer gets used in vtables, so we're safe to fully
drop generating these empty functions. Those are eventually cleaned up
by LLVM, but it's wasteful to produce them in the first place.
@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 14, 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 14, 2025

⌛ Trying commit c839507 with merge d28feb0

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

rust-bors bot added a commit that referenced this pull request Jun 14, 2025
Skip noop drop glue

Since #122662 this no longer gets used in vtables, so we're safe to fully
drop generating these empty functions. Those are eventually cleaned up
by LLVM, but it's wasteful to produce them in the first place.

Opening this for a perf run before asking for review.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 14, 2025
@Mark-Simulacrum Mark-Simulacrum removed the PG-exploit-mitigations Project group: Exploit mitigations label Jun 14, 2025
@rust-bors
Copy link

rust-bors bot commented Jun 14, 2025

☀️ Try build successful (CI)
Build commit: d28feb0 (d28feb066e95d7ce212acfb87a21d02aa98b8928, parent: 9822e3dc15b5940626a186a57f877cf784b1bfb3)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d28feb0): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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)
1.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 5
Improvements ✅
(secondary)
-2.0% [-2.9%, -0.6%] 5
All ❌✅ (primary) -0.1% [-0.4%, 1.0%] 6

Max RSS (memory usage)

Results (primary -1.5%, secondary 2.7%)

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

mean range count
Regressions ❌
(primary)
1.9% [1.6%, 2.1%] 3
Regressions ❌
(secondary)
2.7% [2.1%, 4.0%] 3
Improvements ✅
(primary)
-3.5% [-5.2%, -2.6%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.5% [-5.2%, 2.1%] 8

Cycles

Results (primary 1.1%, 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)
1.1% [1.1%, 1.1%] 1
Regressions ❌
(secondary)
6.1% [6.1%, 6.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-3.3%, -2.2%] 4
All ❌✅ (primary) 1.1% [1.1%, 1.1%] 1

Binary size

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

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

mean range count
Regressions ❌
(primary)
0.3% [0.1%, 1.0%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.8%, -0.0%] 44
Improvements ✅
(secondary)
-1.6% [-5.0%, -0.0%] 17
All ❌✅ (primary) -0.3% [-0.8%, 1.0%] 48

Bootstrap: 757.645s -> 756.931s (-0.09%)
Artifact size: 372.28 MiB -> 372.23 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 Jun 14, 2025
@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Jun 15, 2025
//~ MONO_ITEM fn <Struct<u32> as Trait>::foo
//~ MONO_ITEM fn <Struct<u32> as Trait>::bar
let r1 = &s1 as &Trait;
r1.foo();
r1.bar();

let s1 = Struct { _a: 0u64 };
//~ MONO_ITEM fn std::ptr::drop_in_place::<Struct<u64>> - shim(None) @@ instantiation_through_vtable-cgu.0[External]
//~ MONO_ITEM fn <Struct<u64> as Trait>::foo
//~ MONO_ITEM fn <Struct<u64> as Trait>::bar
let _ = &s1 as &Trait;
Copy link
Member Author

Choose a reason for hiding this comment

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

It seems to me this test is mostly a duplicate of the unsizing test, so I'm skipping updating it with its own drop glue variant -- seems like that's covered there. Maybe worth deleting one of these entirely in a follow-up PR though.

@Mark-Simulacrum Mark-Simulacrum changed the title Skip noop drop glue Skip no-op drop glue Jun 15, 2025
@rust-log-analyzer

This comment has been minimized.

@Mark-Simulacrum Mark-Simulacrum marked this pull request as ready for review June 15, 2025 15:36
@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2025

Some changes occurred in tests/codegen/sanitizer

cc @rcvalle

@Mark-Simulacrum Mark-Simulacrum removed the PG-exploit-mitigations Project group: Exploit mitigations label Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

5 participants