Skip to content

Pass LargeDataThreshold to LLVM module IR - #161670

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
jakos-sec:large-data-threshold
Aug 25, 2026
Merged

Pass LargeDataThreshold to LLVM module IR#161670
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
jakos-sec:large-data-threshold

Conversation

@jakos-sec

Copy link
Copy Markdown
Contributor

Before, LargeDataThreshold was only set via LLVMRustCreateTargetMachine. When LTO is enabled, this information is required to be passed into the generated LLVM module IR files since the LTO linker spins up its own TargetMachine and otherwise has no knowledge of the LargeDataThreshold.

Currently, -Z large-data-threshold has no affect at all when compiling with LTO.
This commit makes sure that if -Z large-data-threshold is passed and not 0, it is preserved and stored into the generated LLVM IR.

Before, LargeDataThreshold was only set via `LLVMRustCreateTargetMachine`.
When LTO is enabled, this information is required to be passed into the
generated LLVM module IR files since the LTO linker spins up its own
TargetMachine and otherwise has no knowledge of the LargeDataThreshold.

Currently, `-Z large-data-threshold` has no affect at all when compiling
with LTO.
This commit makes sure that if `-Z large-data-threshold` is passed and
not 0, it is preserved and stored into the generated LLVM IR.
@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 Aug 24, 2026
@rustbot

rustbot commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
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 75 candidates
  • Random selection from 18 candidates

@jackh726

Copy link
Copy Markdown
Member

r? wg-llvm

@rustbot rustbot assigned nagisa and unassigned jackh726 Aug 24, 2026
Comment thread compiler/rustc_codegen_llvm/src/context.rs Outdated
Previously, the code unwrapped large_data_threshold with a default of
0 and sets it in the LLVM module if it is != 0.
Instead, we should simply check if large_data_threshold has a value.
@nagisa

nagisa commented Aug 24, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e6bae81 has been approved by nagisa

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 Aug 24, 2026
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 24, 2026
…nagisa

Pass LargeDataThreshold to LLVM module IR

Before, LargeDataThreshold was only set via `LLVMRustCreateTargetMachine`. When LTO is enabled, this information is required to be passed into the generated LLVM module IR files since the LTO linker spins up its own TargetMachine and otherwise has no knowledge of the LargeDataThreshold.

Currently, `-Z large-data-threshold` has no affect at all when compiling with LTO.
This commit makes sure that if `-Z large-data-threshold` is passed and not 0, it is preserved and stored into the generated LLVM IR.
rust-bors Bot pushed a commit that referenced this pull request Aug 24, 2026
Rollup of 9 pull requests

Successful merges:

 - #161689 (bootstrap: don't LTO C dependencies on aarch64)
 - #161553 (rustdoc: fix issue preventing "read more" links from generating.)
 - #161670 (Pass LargeDataThreshold to LLVM module IR)
 - #146529 (rustdoc: Nuke `--passes=list` and defossilize the passes infrastructure)
 - #156009 (Check `redundant_explicit_links` against generated URLs)
 - #159583 (Add new `invalid_markdown_table` rustdoc lint)
 - #161098 (PassWrapper: handle LLVM 24 change in function types)
 - #161641 (Check for missing rustfmt in the stdarch intrinsic test step sooner)
 - #161661 (Don't treat slashes as path seps after drive letters in verbatim paths)

Failed merges:

 - #156749 (remove `box_patterns`)
@rust-bors
rust-bors Bot merged commit 0ce1db7 into rust-lang:main Aug 25, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 25, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
Rollup merge of #161670 - jakos-sec:large-data-threshold, r=nagisa

Pass LargeDataThreshold to LLVM module IR

Before, LargeDataThreshold was only set via `LLVMRustCreateTargetMachine`. When LTO is enabled, this information is required to be passed into the generated LLVM module IR files since the LTO linker spins up its own TargetMachine and otherwise has no knowledge of the LargeDataThreshold.

Currently, `-Z large-data-threshold` has no affect at all when compiling with LTO.
This commit makes sure that if `-Z large-data-threshold` is passed and not 0, it is preserved and stored into the generated LLVM IR.
@jakos-sec
jakos-sec deleted the large-data-threshold branch August 25, 2026 08:14
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