Skip to content

Revert OptimizationObjective, add more attributes to entry wrapper - #166707

Open
hanna-kruppe wants to merge 2 commits into
rust-lang:mainfrom
hanna-kruppe:revert-optimization-objective
Open

hanna-kruppe wants to merge 2 commits into
rust-lang:mainfrom
hanna-kruppe:revert-optimization-objective

Conversation

@hanna-kruppe

@hanna-kruppe hanna-kruppe commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

This reverts the parts of #164784 that got pushback after it was merged, and generalizes its bug fix w.r.t. entry wrapper attributes.

This reverts (parts of) commit 32a8daf,
reversing changes made to e30d778.

As discussed in PR 164784 after it was merged, replacing uses of
`OptLevel` with a similar but distinct enum `OptimizationObjective` is
misguided. Other parts of the PR were fine and are not reverted:

* The codegen-llvm tests that were added
* The removal of the unused CodeGenOptSize

In addition, the PR included a fix to apply optsize/minsize to the entry
wrapper based on global opt-level. That fix was fine too, but it's
simpler to revert it along with the rest because the following commit
fixes this and similar issues in a different, more general way.
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Nov 28, 2026
@hanna-kruppe

Copy link
Copy Markdown
Contributor Author

@bors try job=test-various

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 28, 2026
…=<try>

Revert OptimizationObjective, add more attributes to entry wrapper


try-job: test-various
@hanna-kruppe
hanna-kruppe marked this pull request as ready for review November 28, 2026 15:35
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 28, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 28, 2026
@rustbot

rustbot commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 79 candidates
  • Random selection from 22 candidates

@rust-bors rust-bors Bot 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 Nov 28, 2026
@rust-bors

rust-bors Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 41119b0 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

Reuse `llfn_attrs_from_instance`, which despite the name does not
require an `Instance` and is already used for allocator shims. Most
relevant attributes were already being applied elsewhere, but we were
missing optsize/minsize under global opt-level=s/z (after the previous
revert) and had some duplicate code to apply certain attributes to the
entry wrapper specifically.

Separately, cg_ssa also re-applies certain attributes (frame pointer,
target features) to the entry wrapper. I didn't change that because I'm
not sure if other backends rely on it. If so, those backends may benefit
from similar changes (or a larger refactoring to cg_ssa), but that's out
of scope for this PR.
@hanna-kruppe
hanna-kruppe force-pushed the revert-optimization-objective branch from 426198a to 054739b Compare November 28, 2026 16:39
@hanna-kruppe

Copy link
Copy Markdown
Contributor Author

@bors try job=test-various

@rust-bors

rust-bors Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Trying commit 054739b with merge 9f0ad7b…

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

Workflow: https://github.com/rust-lang/rust/actions/runs/46167057619

rust-bors Bot pushed a commit that referenced this pull request Nov 28, 2026
…=<try>

Revert OptimizationObjective, add more attributes to entry wrapper


try-job: test-various

This branch has not been deployed

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

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants