Skip to content

Stop useless caching of post-LTO artifact caching for fat LTO - #163317

Merged
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
bjorn3:lto_refactors22
Oct 21, 2026
Merged

rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
bjorn3:lto_refactors22

Conversation

@bjorn3

@bjorn3 bjorn3 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

View all comments

These artifacts are never actually used. Only the pre-LTO artifacts would be useful, but caching that seems a bit more tricky and is not that important for now. Fat LTO itself is very slow anyway.

Also move incr comp session dirs out of CodegenContext. CodegenContext will in the future be serialized and deserialized into a different rustc instance when -Zno-link/-Zlink-only is used. A separate incr comp session has to be used for both rustc invocations.

Part of rust-lang/compiler-team#908

@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

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 Sep 25, 2026
@rustbot

rustbot commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
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: codegen, compiler
  • codegen, compiler expanded to 77 candidates
  • Random selection from 21 candidates

@rust-log-analyzer

This comment has been minimized.

if !self.check_config(cfg) {
debug!("check_attr: config does not match, ignoring attr");
return;
continue;

@bjorn3 bjorn3 Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This caused us to skip all assertions after the first one with a cfg that doesn't match. Surprisingly nothing regressed by the lack of test coverage since the introduction of this bug.

View changes since the review

@bjorn3 bjorn3 changed the title Fix incr comp for fat LTO Fix incremental compilation for fat LTO Sep 27, 2026

@mejrs mejrs left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure about this otherwise.

r? @nnethercote perhaps?

View changes since this review

Comment thread compiler/rustc_codegen_llvm/src/back/llvm_backend.rs
@rustbot rustbot assigned nnethercote and unassigned mejrs Sep 30, 2026

@nnethercote nnethercote left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r=me with the nits addressed.

View changes since this review

Comment thread compiler/rustc_session/src/session.rs Outdated
};

// FIXME include pre-LTO bitcode in workproduct tracking
// FIXME add separate incr comp session for post-LTO outputs to use during link step

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How important are these FIXMEs? Are you planning to fix them?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm working on a follow up PR to do this.

@nnethercote nnethercote 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 Oct 2, 2026
@bjorn3

bjorn3 commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

@bors r=nnethercote

@rust-bors

rust-bors Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ebdd423 has been tentatively approved by nnethercote

It will be put into the queue for this repository once PR CI succeeds.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 2, 2026
Fix incremental compilation for fat LTO

Previously we would copy post-LTO artifacts into the incr comp cache for fat LTO despite them never getting used. Also the pre-LTO bitcode didn't get tracked and thus `determine_cgu_reuse` believed it had to regenerate bitcode for all CGUs even when all CGUs would be green.

Also move incr comp session dirs out of `CodegenContext`. `CodegenContext` will in the future be serialized and deserialized into a different rustc instance when `-Zno-link`/`-Zlink-only` is used. A separate incr comp session has to be used for both rustc invocations.

Part of rust-lang/compiler-team#908
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 2, 2026
Fix incremental compilation for fat LTO

Previously we would copy post-LTO artifacts into the incr comp cache for fat LTO despite them never getting used. Also the pre-LTO bitcode didn't get tracked and thus `determine_cgu_reuse` believed it had to regenerate bitcode for all CGUs even when all CGUs would be green.

Also move incr comp session dirs out of `CodegenContext`. `CodegenContext` will in the future be serialized and deserialized into a different rustc instance when `-Zno-link`/`-Zlink-only` is used. A separate incr comp session has to be used for both rustc invocations.

Part of rust-lang/compiler-team#908
rust-bors Bot pushed a commit that referenced this pull request Oct 2, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - #163317 (Fix incremental compilation for fat LTO)
 - #163582 (Reapply "bootstrap: Enable rustdoc mergeable CCI for std and internal docs")
 - #151793 (Add mul_add_relaxed methods for floating-point types)
 - #162782 (Fix rustdoc ICE caused by mishandling of ambiguity errors)
 - #163010 (Miri can do dirfd now)
 - #163535 (Improve `DocStrings` perf)
 - #163576 (Fix `TypeOutlives` fast-path)
 - #163587 (Several small span improvements)
 - #163612 (fix `ValidateBoundVars`)
 - #163632 (bump rustc-build-sysroot)
 - #163635 (Revert note about signum of NaN)
 - #163644 (Add mailmap entry)
 - #163651 (Remove variants from `feature-gate-autodiff-use` test)
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #163650 (comment)

@bors try jobs=test-x86_64-mingw-1

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

rust-bors Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#163656), which was unapproved.

View changes since this unapproval

@bjorn3

bjorn3 commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Reverted some changes that turned out needed to be reverted anyway in the follow up PR.

@bors try jobs=test-x86_64-mingw-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
Fix incremental compilation for fat LTO


try-job: test-x86_64-mingw-1
@rust-bors

rust-bors Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

💔 Test for d316683 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

These artifacts are never actually used. Only the pre-LTO artifacts
would be useful, but caching that seems a bit more tricky and is not
that important for now. Fat LTO itself is very slow anyway.
@bjorn3 bjorn3 changed the title Fix incremental compilation for fat LTO Stop useless caching of post-LTO artifact caching for fat LTO Oct 20, 2026
@bjorn3

bjorn3 commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

When reproducing the MinGW failure, I noticed that the PR was accidentally also caching the bitcode of dependencies in the incr comp cache, which doesn't have any benefit. I've removed the support for pre-LTO caching for fat LTO from this PR for now. So this PR now only does refactorings and removes the useless post-LTO artifact caching for fat LTO. I've confirmed that the test that previously failed on MinGW now passes.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 20, 2026
@nnethercote

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 51e5451 has been tentatively approved by nnethercote

It will be put into the queue for this repository once PR CI succeeds.

@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 Oct 20, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 20, 2026
Stop useless caching of post-LTO artifact caching for fat LTO

These artifacts are never actually used. Only the pre-LTO artifacts would be useful, but caching that seems a bit more tricky and is not that important for now. Fat LTO itself is very slow anyway.

Also move incr comp session dirs out of `CodegenContext`. `CodegenContext` will in the future be serialized and deserialized into a different rustc instance when `-Zno-link`/`-Zlink-only` is used. A separate incr comp session has to be used for both rustc invocations.

Part of rust-lang/compiler-team#908
rust-bors Bot pushed a commit that referenced this pull request Oct 20, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests)
 - #163668 (Remap syntax contexts and expansion ids for det. metadata encoding)
 - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd)
 - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs)
 - #163317 (Stop useless caching of post-LTO artifact caching for fat LTO)
 - #163701 (add ReadDir::dir to get the directory handle of the underlying directory)
 - #164488 (Don't try to skip anything in `Skip::advance_by(0)`)
 - #164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism)
 - #164611 (Improve bit permutation codegen)
 - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`)
 - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`)
 - #162668 (document that `!` does bitwise and logical negation)
 - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons)
 - #164509 (layout invariant: turn delayed bug back into proper assertion)
 - #164540 (Minor optimizations around macro parsing)
 - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules)
 - #164595 (Allow attributes in function trait parameters)
 - #164641 (Stabilize `slice_split_once`)
 - #164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
rust-bors Bot pushed a commit that referenced this pull request Oct 21, 2026
Rollup of 20 pull requests

Successful merges:

 - #163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests)
 - #163668 (Remap syntax contexts and expansion ids for det. metadata encoding)
 - #163104 ([debuginfo] Emit `usize` and `isize` as typedefs)
 - #163317 (Stop useless caching of post-LTO artifact caching for fat LTO)
 - #163701 (add ReadDir::dir to get the directory handle of the underlying directory)
 - #164488 (Don't try to skip anything in `Skip::advance_by(0)`)
 - #164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism)
 - #164611 (Improve bit permutation codegen)
 - #164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`)
 - #148842 (Avoid incorrect lifetime suggestion involving `sym::anon`)
 - #162668 (document that `!` does bitwise and logical negation)
 - #164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons)
 - #164509 (layout invariant: turn delayed bug back into proper assertion)
 - #164540 (Minor optimizations around macro parsing)
 - #164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules)
 - #164595 (Allow attributes in function trait parameters)
 - #164616 (Add test for VecDeque with a custom allocator)
 - #164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
 - #164641 (Stabilize `slice_split_once`)
 - #164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
@rust-bors
rust-bors Bot merged commit b384351 into rust-lang:main Oct 21, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 21, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 21, 2026
Rollup merge of #163317 - bjorn3:lto_refactors22, r=nnethercote

Stop useless caching of post-LTO artifact caching for fat LTO

These artifacts are never actually used. Only the pre-LTO artifacts would be useful, but caching that seems a bit more tricky and is not that important for now. Fat LTO itself is very slow anyway.

Also move incr comp session dirs out of `CodegenContext`. `CodegenContext` will in the future be serialized and deserialized into a different rustc instance when `-Zno-link`/`-Zlink-only` is used. A separate incr comp session has to be used for both rustc invocations.

Part of rust-lang/compiler-team#908
@bjorn3
bjorn3 deleted the lto_refactors22 branch October 21, 2026 07:56
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Oct 22, 2026
Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests)
 - rust-lang/rust#163668 (Remap syntax contexts and expansion ids for det. metadata encoding)
 - rust-lang/rust#163104 ([debuginfo] Emit `usize` and `isize` as typedefs)
 - rust-lang/rust#163317 (Stop useless caching of post-LTO artifact caching for fat LTO)
 - rust-lang/rust#163701 (add ReadDir::dir to get the directory handle of the underlying directory)
 - rust-lang/rust#164488 (Don't try to skip anything in `Skip::advance_by(0)`)
 - rust-lang/rust#164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism)
 - rust-lang/rust#164611 (Improve bit permutation codegen)
 - rust-lang/rust#164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`)
 - rust-lang/rust#148842 (Avoid incorrect lifetime suggestion involving `sym::anon`)
 - rust-lang/rust#162668 (document that `!` does bitwise and logical negation)
 - rust-lang/rust#164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons)
 - rust-lang/rust#164509 (layout invariant: turn delayed bug back into proper assertion)
 - rust-lang/rust#164540 (Minor optimizations around macro parsing)
 - rust-lang/rust#164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules)
 - rust-lang/rust#164595 (Allow attributes in function trait parameters)
 - rust-lang/rust#164616 (Add test for VecDeque with a custom allocator)
 - rust-lang/rust#164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
 - rust-lang/rust#164641 (Stabilize `slice_split_once`)
 - rust-lang/rust#164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
jieyouxu pushed a commit to jieyouxu/rustfmt that referenced this pull request Oct 22, 2026
Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests)
 - rust-lang/rust#163668 (Remap syntax contexts and expansion ids for det. metadata encoding)
 - rust-lang/rust#163104 ([debuginfo] Emit `usize` and `isize` as typedefs)
 - rust-lang/rust#163317 (Stop useless caching of post-LTO artifact caching for fat LTO)
 - rust-lang/rust#163701 (add ReadDir::dir to get the directory handle of the underlying directory)
 - rust-lang/rust#164488 (Don't try to skip anything in `Skip::advance_by(0)`)
 - rust-lang/rust#164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism)
 - rust-lang/rust#164611 (Improve bit permutation codegen)
 - rust-lang/rust#164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`)
 - rust-lang/rust#148842 (Avoid incorrect lifetime suggestion involving `sym::anon`)
 - rust-lang/rust#162668 (document that `!` does bitwise and logical negation)
 - rust-lang/rust#164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons)
 - rust-lang/rust#164509 (layout invariant: turn delayed bug back into proper assertion)
 - rust-lang/rust#164540 (Minor optimizations around macro parsing)
 - rust-lang/rust#164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules)
 - rust-lang/rust#164595 (Allow attributes in function trait parameters)
 - rust-lang/rust#164616 (Add test for VecDeque with a custom allocator)
 - rust-lang/rust#164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
 - rust-lang/rust#164641 (Stabilize `slice_split_once`)
 - rust-lang/rust#164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
programskillforverification pushed a commit to programskillforverification/miri that referenced this pull request Oct 22, 2026
Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#163664 (Add new `RUSTC_BOOTSTRAP=-allow-unstable-compiler-flags` mode for testing stable compiler behavior in UI tests)
 - rust-lang/rust#163668 (Remap syntax contexts and expansion ids for det. metadata encoding)
 - rust-lang/rust#163104 ([debuginfo] Emit `usize` and `isize` as typedefs)
 - rust-lang/rust#163317 (Stop useless caching of post-LTO artifact caching for fat LTO)
 - rust-lang/rust#163701 (add ReadDir::dir to get the directory handle of the underlying directory)
 - rust-lang/rust#164488 (Don't try to skip anything in `Skip::advance_by(0)`)
 - rust-lang/rust#164507 (Encode HashMap and HashSet in deterministic order when an encoder requires determinism)
 - rust-lang/rust#164611 (Improve bit permutation codegen)
 - rust-lang/rust#164612 (std: Combine `is_powerpc64_feature_detected` into `is_powerpc_feature_detected`)
 - rust-lang/rust#148842 (Avoid incorrect lifetime suggestion involving `sym::anon`)
 - rust-lang/rust#162668 (document that `!` does bitwise and logical negation)
 - rust-lang/rust#164264 (lint: suggest `fXX::is_nan` for unsuffixed NaN comparisons)
 - rust-lang/rust#164509 (layout invariant: turn delayed bug back into proper assertion)
 - rust-lang/rust#164540 (Minor optimizations around macro parsing)
 - rust-lang/rust#164594 (rustdoc: Correctly handle inner `deprecated` attribute on modules)
 - rust-lang/rust#164595 (Allow attributes in function trait parameters)
 - rust-lang/rust#164616 (Add test for VecDeque with a custom allocator)
 - rust-lang/rust#164629 (arch::breakpoint: avoid confusing 'equivalent' terminology)
 - rust-lang/rust#164641 (Stabilize `slice_split_once`)
 - rust-lang/rust#164646 (Adjust rustfmt subtree sync docs to not use `--allow-noop` for now)
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.

6 participants