Skip to content

Remove -Zemit-thin-lto flag#152527

Open
bjorn3 wants to merge 2 commits intorust-lang:mainfrom
bjorn3:remove_z_emit_thin_lto
Open

Remove -Zemit-thin-lto flag#152527
bjorn3 wants to merge 2 commits intorust-lang:mainfrom
bjorn3:remove_z_emit_thin_lto

Conversation

@bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Feb 12, 2026

As far as I can tell it was introduced in #98162 to allow fat LTO with -Clinker-plugin-lto. In #136840 a change was made to automatically disable ThinLTO summary generation when -Clinker-plugin-lto -Clto=fat is used, so we can safely remove it.

Fixes #152490

As far as I can tell it was introduced to allow fat LTO with
-Clinker-plugin-lto. Later a change was made to automatically disable
ThinLTO summary generation when -Clinker-plugin-lto -Clto=fat is used,
so we can safely remove it.
@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 Feb 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

r? @cuviper

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


ModulePassManager MPM;
bool NeedThinLTOBufferPasses = EmitThinLTO;
bool NeedThinLTOBufferPasses = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

This used to be true when fat LTO is not used, so I ensured all fat LTO phases do NeedThinLTOBufferPasses = false below.

MPM.addPass(BitcodeWriterPass(ThinLTODataOS));
}
MPM.addPass(ThinLTOBitcodeWriterPass(
ThinLTODataOS, EmitThinLTOSummary ? &ThinLinkDataOS : nullptr));
Copy link
Member Author

Choose a reason for hiding this comment

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

PreLinkNoLTO is never used when fat LTO is enabled.

if (EmitThinLTO) {
// thin lto summaries prevent fat lto, so do not emit them if fat
// lto is requested. See PR #136840 for background information.
if (OptStage != LLVMRustOptStage::PreLinkFatLTO) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't need to check LLVMRustOptStage::FatLTO as ThinLTOBufferRef is NULL in that case.

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-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.

Remove -Zemit-thin-lto flag

3 participants