Skip to content

small cleanups in rustc_codegen_llvm - #165622

Merged
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
malezjaa:cleanup-llvm-codegen
Nov 13, 2026
Merged

rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
malezjaa:cleanup-llvm-codegen

Conversation

@malezjaa

@malezjaa malezjaa commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

small clippy cleanups

@rustbot

rustbot commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_llvm/src/debuginfo

cc @Walnut356

Some changes occurred in compiler/rustc_codegen_llvm/src/builder/autodiff.rs

cc @ZuseZ4

Some changes occurred in coverage instrumentation.

cc @Zalathar

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` 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 Nov 8, 2026
@rustbot

rustbot commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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 79 candidates
  • Random selection from 23 candidates

@rust-bors

This comment has been minimized.

@Zalathar

Zalathar commented Nov 8, 2026

Copy link
Copy Markdown
Member

This is a large number of individual changes mixed together (despite the modest line count), some of which are more contentious than others, which makes reviewing this a bit of a slog.

I'd suggest separating the different kinds of changes into separate commits, to make it easier to check that each kind of change looks good.

let value_words = [value as u64, (value >> 64) as u64];
let size_in_bits = size.bits();
// LLVM computes `NumWords = (SizeInBits + 63) / 64`.
assert!((size_in_bits + 63) / 64 <= value_words.len() as u64);

@Zalathar Zalathar Nov 8, 2026 •

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.

This assertion is deliberately written to match the LLVM computation, and should not be changed, since the change makes it harder to verify that both sides are performing the same computation.

View changes since the review

Comment on lines +254 to +260
feature_err(
self.sess(),
feature,
span,
"C-variadic function definitions on this target are unstable",
)
.emit();

@Zalathar Zalathar Nov 8, 2026 •

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.

This seems worse than the status quo, as the call is now spread across several lines without an increase in clarity. I would at least retain msg as a local variable to make the call more compact.

View changes since the review

Comment on lines +150 to +152
// Set up the small-data optimization limit for architectures that use
// an LLVM argument to control this.
if let (Some(threshold), SmallDataThresholdSupport::LlvmArg(arg)) = (

@Zalathar Zalathar Nov 8, 2026 •

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.

If we're bothering to clean up this match, then IMO it should become an if-let chain rather than an odd if-let on a tuple.

View changes since the review

Comment on lines +52 to +59
pub(crate) fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type]) {
unsafe { llvm::LLVMStructSetBody(ty, els.as_ptr(), els.len() as c_uint, FALSE) }
}

pub(crate) fn set_packed_struct_body(&self, ty: &'ll Type, els: &[&'ll Type]) {
unsafe { llvm::LLVMStructSetBody(ty, els.as_ptr(), els.len() as c_uint, TRUE) }
}

@Zalathar Zalathar Nov 8, 2026 •

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.

This is the sort of change that should be presented in its own commit at least, not bundled in with dozens of trivial changes.

View changes since the review

@malezjaa
malezjaa force-pushed the cleanup-llvm-codegen branch from 23fa2fa to c4fab04 Compare November 8, 2026 12:21
@rustbot

rustbot commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

Some changes occurred in GUI tests.

cc @GuillaumeGomez

This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp.

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @lolbinarycat

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Some changes occurred in src/tools/cargo

cc @weihanglo

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustdoc-js Area: Rustdoc's JS front-end A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Nov 8, 2026
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@malezjaa

malezjaa commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

oh no, i messed up a rebase. let me fix it

@malezjaa
malezjaa force-pushed the cleanup-llvm-codegen branch from c4fab04 to 04cc725 Compare November 8, 2026 12:37
@rustbot

This comment has been minimized.

@malezjaa

malezjaa commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Sorry to everyone who got pinged 😅

I should've split these up into commit from the start.
Also I cleaned up remaining needless borrows. (all of them are in one commit)

@rust-bors

This comment has been minimized.

@malezjaa
malezjaa force-pushed the cleanup-llvm-codegen branch from 04cc725 to 6fa07e2 Compare November 8, 2026 14:24
@rustbot

This comment has been minimized.

@malezjaa
malezjaa force-pushed the cleanup-llvm-codegen branch from 3ba6ed9 to 52e0f08 Compare November 12, 2026 16:01
@rustbot

rustbot commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

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.

@malezjaa
malezjaa force-pushed the cleanup-llvm-codegen branch from 52e0f08 to 7dc2ea1 Compare November 12, 2026 16:25
@Zalathar

Copy link
Copy Markdown
Member

Looks good, thanks. Good job on squashing the fixups into their original commits.

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7dc2ea1 has been approved by Zalathar

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 Nov 13, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 13, 2026
…alathar

small cleanups in rustc_codegen_llvm

small clippy cleanups
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
Rollup of 13 pull requests

Successful merges:

 - #164707 (Re-enable rustc profile generation for static linked llvm on Windows x64 builds )
 - #165068 (Change color usage for highlights)
 - #165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165622 (small cleanups in rustc_codegen_llvm)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165823 (Tweak crate error wording and turn them into fatal errors)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165872 (Some attribute related cleanups)

Failed merges:

 - #165861 (cg_llvm: Use an invariant lifetime brand for LLVM attributes)
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 13, 2026
…alathar

small cleanups in rustc_codegen_llvm

small clippy cleanups
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
Rollup of 11 pull requests

Successful merges:

 - #165068 (Change color usage for highlights)
 - #165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165622 (small cleanups in rustc_codegen_llvm)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165872 (Some attribute related cleanups)

Failed merges:

 - #165861 (cg_llvm: Use an invariant lifetime brand for LLVM attributes)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors try jobs=test-various

rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
small cleanups in rustc_codegen_llvm


try-job: test-various
@rust-bors

This comment has been minimized.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 13, 2026
…alathar

small cleanups in rustc_codegen_llvm

small clippy cleanups
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #164828 (When suggesting path of renamed crate, use the renamed name)
 - #164864 (Avoid hoisting uninitialized reads in EarlyOtherwiseBranch)
 - #165068 (Change color usage for highlights)
 - #165221 (Canonicalize more comparison operators)
 - #165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - #165869 (Cleanup: Remove `path_matches` and `value_str` from `AttributeExt`)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165622 (small cleanups in rustc_codegen_llvm)
 - #165745 (Don't ICE when a guard condition is a place of type `!`)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165823 (Tweak crate error wording and turn them into fatal errors)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165872 (Some attribute related cleanups)
 - #165905 (CI: Use a consistent locale when sorting docker build inputs)
@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c2f89a6 (c2f89a6d8c7e50429f131c89fe9283dfae289736)
Base parent: 75bb7a3 (75bb7a374ff3f5363432a17e8000b50a60a4530c)

rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #164828 (When suggesting path of renamed crate, use the renamed name)
 - #164864 (Avoid hoisting uninitialized reads in EarlyOtherwiseBranch)
 - #165068 (Change color usage for highlights)
 - #165221 (Canonicalize more comparison operators)
 - #165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - #165869 (Cleanup: Remove `path_matches` and `value_str` from `AttributeExt`)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165622 (small cleanups in rustc_codegen_llvm)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165823 (Tweak crate error wording and turn them into fatal errors)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165872 (Some attribute related cleanups)
 - #165905 (CI: Use a consistent locale when sorting docker build inputs)
@rust-bors
rust-bors Bot merged commit 89bc62c into rust-lang:main Nov 13, 2026
15 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 13, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
Rollup merge of #165622 - malezjaa:cleanup-llvm-codegen, r=Zalathar

small cleanups in rustc_codegen_llvm

small clippy cleanups
rust-bors Bot pushed a commit that referenced this pull request Nov 14, 2026
…lathar"

This reverts commit 89bc62c, reversing
changes made to f3cb01f.
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Nov 16, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#164828 (When suggesting path of renamed crate, use the renamed name)
 - rust-lang/rust#164864 (Avoid hoisting uninitialized reads in EarlyOtherwiseBranch)
 - rust-lang/rust#165068 (Change color usage for highlights)
 - rust-lang/rust#165221 (Canonicalize more comparison operators)
 - rust-lang/rust#165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - rust-lang/rust#165869 (Cleanup: Remove `path_matches` and `value_str` from `AttributeExt`)
 - rust-lang/rust#165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - rust-lang/rust#164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - rust-lang/rust#165565 (view-types: lower view types from HIR)
 - rust-lang/rust#165622 (small cleanups in rustc_codegen_llvm)
 - rust-lang/rust#165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - rust-lang/rust#165810 (reflection: reflect attributes from adts, fields, and variants)
 - rust-lang/rust#165823 (Tweak crate error wording and turn them into fatal errors)
 - rust-lang/rust#165849 (More opt-dist improvements)
 - rust-lang/rust#165855 (Update `sysinfo` version to `0.40.3`)
 - rust-lang/rust#165872 (Some attribute related cleanups)
 - rust-lang/rust#165905 (CI: Use a consistent locale when sorting docker build inputs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustdoc-js Area: Rustdoc's JS front-end A-testsuite Area: The testsuite used to check the correctness of rustc F-autodiff `#![feature(autodiff)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants