Skip to content

Various LTO cleanups#153440

Merged
rust-bors[bot] merged 5 commits intorust-lang:mainfrom
bjorn3:lto_refactors13
Apr 6, 2026
Merged

Various LTO cleanups#153440
rust-bors[bot] merged 5 commits intorust-lang:mainfrom
bjorn3:lto_refactors13

Conversation

@bjorn3
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 commented Mar 5, 2026

  • Move some special casing of thin local LTO into a single location.
  • Move lto_import_only_modules handling for fat LTO earlier. There is no reason to keep it separate until right before pass the LTO modules to the codegen backend. For thin LTO this introduces ThinLtoInput to correctly handle incr comp caching.
  • Remove the Linker type from cg_llvm. It previously helped deduplicate code for -Zcombine-cgus, but that flag no longer exists.

Part of rust-lang/compiler-team#908

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 5, 2026

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. labels Mar 5, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 5, 2026

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
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 69 candidates
  • Random selection from 16 candidates

@antoyo
Copy link
Copy Markdown
Contributor

antoyo commented Mar 5, 2026

Before we introduce more LTO changes, would it be possible to fix this issue introduced by your previous LTO change please?

It would be nice to also add a test for this specific scenario in the Rust CI.

@bjorn3
Copy link
Copy Markdown
Member Author

bjorn3 commented Mar 5, 2026

I missed that comment. Will take a look.

@bjorn3
Copy link
Copy Markdown
Member Author

bjorn3 commented Mar 5, 2026

@rustbot block until cg_gcc is unblocked

@bjorn3
Copy link
Copy Markdown
Member Author

bjorn3 commented Mar 5, 2026

@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 5, 2026
@bjorn3
Copy link
Copy Markdown
Member Author

bjorn3 commented Mar 27, 2026

The cg_gcc sync has been fixed.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Mar 27, 2026
bjorn3 added 5 commits April 1, 2026 14:14
By not pushing any crates to each_linked_rlib_for_lto when no
cross-crate LTO is used, we can avoid special cases elsewhere.
It is still not entirely correct I think, but much
closer to the current way things are done.
@bjorn3 bjorn3 force-pushed the lto_refactors13 branch from 2c80a2f to 3303a26 Compare April 1, 2026 14:15
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 1, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@TaKO8Ki
Copy link
Copy Markdown
Member

TaKO8Ki commented Apr 5, 2026

@bor r+

@bjorn3
Copy link
Copy Markdown
Member Author

bjorn3 commented Apr 5, 2026

@bors r=TaKO8Ki

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 5, 2026

📌 Commit 3303a26 has been approved by TaKO8Ki

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Apr 5, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 5, 2026
Various LTO cleanups

* Move some special casing of thin local LTO into a single location.
* Move lto_import_only_modules handling for fat LTO earlier. There is no reason to keep it separate until right before pass the LTO modules to the codegen backend. For thin LTO this introduces `ThinLtoInput` to correctly handle incr comp caching.
* Remove the `Linker` type from cg_llvm. It previously helped deduplicate code for `-Zcombine-cgus`, but that flag no longer exists.

Part of rust-lang/compiler-team#908
rust-bors bot pushed a commit that referenced this pull request Apr 5, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
rust-bors bot pushed a commit that referenced this pull request Apr 5, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
rust-bors bot pushed a commit that referenced this pull request Apr 6, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154808 (Post-attribute ports cleanup pt. 1)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 6, 2026
Various LTO cleanups

* Move some special casing of thin local LTO into a single location.
* Move lto_import_only_modules handling for fat LTO earlier. There is no reason to keep it separate until right before pass the LTO modules to the codegen backend. For thin LTO this introduces `ThinLtoInput` to correctly handle incr comp caching.
* Remove the `Linker` type from cg_llvm. It previously helped deduplicate code for `-Zcombine-cgus`, but that flag no longer exists.

Part of rust-lang/compiler-team#908
rust-bors bot pushed a commit that referenced this pull request Apr 6, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #153440 (Various LTO cleanups)
 - #151899 (Constify fold, reduce and last for iterator)
 - #154561 (Suggest similar keyword when visibility is not followed by an item)
 - #154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - #154717 (Fix ICE in unsafe binder discriminant helpers)
 - #154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - #154777 (`#[cfg]`: suggest alternative `target_` name when the value does not match)
 - #154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - #154850 (ast_validation: scalable vectors okay for rustdoc)
@rust-bors rust-bors bot merged commit 5f8b828 into rust-lang:main Apr 6, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 6, 2026
rust-timer added a commit that referenced this pull request Apr 6, 2026
Rollup merge of #153440 - bjorn3:lto_refactors13, r=TaKO8Ki

Various LTO cleanups

* Move some special casing of thin local LTO into a single location.
* Move lto_import_only_modules handling for fat LTO earlier. There is no reason to keep it separate until right before pass the LTO modules to the codegen backend. For thin LTO this introduces `ThinLtoInput` to correctly handle incr comp caching.
* Remove the `Linker` type from cg_llvm. It previously helped deduplicate code for `-Zcombine-cgus`, but that flag no longer exists.

Part of rust-lang/compiler-team#908
@bjorn3 bjorn3 deleted the lto_refactors13 branch April 6, 2026 10:48
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 7, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#153440 (Various LTO cleanups)
 - rust-lang/rust#151899 (Constify fold, reduce and last for iterator)
 - rust-lang/rust#154561 (Suggest similar keyword when visibility is not followed by an item)
 - rust-lang/rust#154657 (Fix pattern assignment suggestions for uninitialized bindings)
 - rust-lang/rust#154717 (Fix ICE in unsafe binder discriminant helpers)
 - rust-lang/rust#154722 (fix(lints): Improve `ill_formed_attribute_input` with better help message)
 - rust-lang/rust#154777 (`#[cfg]`: suggest alternative `target_` name when the value does not match)
 - rust-lang/rust#154849 (Promote `char::is_case_ignorable` from perma-unstable to unstable)
 - rust-lang/rust#154850 (ast_validation: scalable vectors okay for rustdoc)
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-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.

4 participants