Pass LargeDataThreshold to LLVM module IR - #161670
Merged
Merged
Conversation
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.
Collaborator
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
r? wg-llvm |
nagisa
reviewed
Aug 24, 2026
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.
Member
|
@bors r+ |
Contributor
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.
This was referenced Aug 24, 2026
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 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-thresholdhas no affect at all when compiling with LTO.This commit makes sure that if
-Z large-data-thresholdis passed and not 0, it is preserved and stored into the generated LLVM IR.