Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code from rustc_codegen_llvm and the LLVM wrapper #136653

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

dpaoliello
Copy link
Contributor

First step to clean up the LLVM wrapper: remove existing dead code.

Split out of #135502

r? @Zalathar

@rustbot rustbot added 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 6, 2025
pub kind: OptimizationDiagnosticKind,
pub pass_name: String,
pub function: &'ll Value,
Copy link
Contributor

Choose a reason for hiding this comment

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

This field should be kept, even if it's currently unused on the Rust side, because it reflects part of a larger LLVM data structure.

(Keeping C++ and Rust in sync is easier if we don't have ad-hoc gaps in individual structures and enums.)

InlineAsm(InlineAsmDiagnostic),
PGO(&'ll DiagnosticInfo),
Linker(&'ll DiagnosticInfo),
Unsupported(&'ll DiagnosticInfo),

/// LLVM has other types that we do not wrap here.
UnknownDiagnostic(&'ll DiagnosticInfo),
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this field shouldn't be removed, even if it's unused.

Comment on lines -77 to -83
pub enum LLVMMachineType {
AMD64 = 0x8664,
I386 = 0x14c,
ARM64 = 0xaa64,
ARM64EC = 0xa641,
ARM = 0x01c0,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Historical note: It looks like we used to pass this to LLVM code for emitting import libraries on Windows, and it probably became unnecessary after #129164. Good to remove.

Comment on lines -651 to -656
pub enum TailCallKind {
None,
Tail,
MustTail,
NoTail,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remark: This removal was justified in #135502 (comment), so good to remove.

@@ -799,7 +775,6 @@ unsafe extern "C" {
}

pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
Copy link
Contributor

Choose a reason for hiding this comment

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

Historical note: Looks like this became unused in #100460.

@@ -2586,8 +2559,6 @@ unsafe extern "C" {

pub fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;

pub fn LLVMRustIsBitcode(ptr: *const u8, len: usize) -> bool;
Copy link
Contributor

Choose a reason for hiding this comment

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

Historical note: This became unused in 9de0d14.

@@ -853,7 +828,6 @@ pub mod debuginfo {
pub type DIFile = DIScope;
pub type DILexicalBlock = DIScope;
pub type DISubprogram = DIScope;
pub type DINameSpace = DIScope;
Copy link
Contributor

Choose a reason for hiding this comment

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

Historical note: This became unused in #136375.

@Zalathar
Copy link
Contributor

Zalathar commented Feb 7, 2025

The changes to Diagnostic should be reverted, but everything else looks good.

@dpaoliello
Copy link
Contributor Author

The changes to Diagnostic should be reverted, but everything else looks good.

Done

@Zalathar
Copy link
Contributor

Zalathar commented Feb 7, 2025

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 7, 2025

📌 Commit 2a6b274 has been approved by Zalathar

It is now in the queue for this repository.

@bors bors 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 Feb 7, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 7, 2025
Remove dead code from rustc_codegen_llvm and the LLVM wrapper

First step to clean up the LLVM wrapper: remove existing dead code.

Split out of rust-lang#135502

r? `@Zalathar`
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 7, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#134367 (Stabilize `feature(trait_upcasting)`)
 - rust-lang#135354 ([Debuginfo] Add MSVC Synthetic and Summary providers to LLDB)
 - rust-lang#135940 (Update toolstate maintainers)
 - rust-lang#135945 (Remove some unnecessary parens in `assert!` conditions)
 - rust-lang#136577 (Pattern Migration 2024: try to suggest eliding redundant binding modifiers)
 - rust-lang#136598 (Fix suggestion for `dependency_on_unit_never_type_fallback` involving closures + format args expansions)
 - rust-lang#136653 (Remove dead code from rustc_codegen_llvm and the LLVM wrapper)
 - rust-lang#136664 (replace one `.map_or(true, ...)` with `.is_none_or(...)`)

Failed merges:

 - rust-lang#136193 (Implement pattern type ffi checks)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 7, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#134367 (Stabilize `feature(trait_upcasting)`)
 - rust-lang#135940 (Update toolstate maintainers)
 - rust-lang#135945 (Remove some unnecessary parens in `assert!` conditions)
 - rust-lang#136577 (Pattern Migration 2024: try to suggest eliding redundant binding modifiers)
 - rust-lang#136598 (Fix suggestion for `dependency_on_unit_never_type_fallback` involving closures + format args expansions)
 - rust-lang#136653 (Remove dead code from rustc_codegen_llvm and the LLVM wrapper)
 - rust-lang#136664 (replace one `.map_or(true, ...)` with `.is_none_or(...)`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7c0dff8 into rust-lang:master Feb 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 7, 2025
Rollup merge of rust-lang#136653 - dpaoliello:cleanllvm1, r=Zalathar

Remove dead code from rustc_codegen_llvm and the LLVM wrapper

First step to clean up the LLVM wrapper: remove existing dead code.

Split out of rust-lang#135502

r? ``@Zalathar``
@dpaoliello dpaoliello deleted the cleanllvm1 branch February 11, 2025 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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