Skip to content

Add an optional llvm = argument to rustc_intrinsic. - #164544

Open
veluca93 wants to merge 1 commit into
rust-lang:mainfrom
veluca93:rustc_llvm_intrinsic
Open

veluca93 wants to merge 1 commit into
rust-lang:mainfrom
veluca93:rustc_llvm_intrinsic

Conversation

@veluca93

@veluca93 veluca93 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

This is meant for usage in core::arch, to define the platform-specific LLVM intrinsics that correspond to each intrinsic.

LLM usage: I used an LLM to point me at places in the code from which to start the implementation, but I did not generate any code. The main non-trivial input from the LLM was to prevent inlining of callees annotated with rustc_llvm_intrinsic. Code has been since re-designed following @bjorn3's and @RalfJung's proposals so there's no trace of any LLM input left :-)

r? RalfJ

@rustbot

rustbot commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Oct 18, 2026
@rustbot

rustbot commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Error: Failed to set assignee to RalfJ: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@veluca93

Copy link
Copy Markdown
Contributor Author

r? RalfJung

@rustbot

rustbot commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

@tgross35

Copy link
Copy Markdown
Member

Cc @folkertdev

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 39047e6 to a0ad71b Compare October 19, 2026 07:09
@bjorn3

bjorn3 commented Oct 19, 2026

Copy link
Copy Markdown
Member

Can you check that all places in the compiler that check for extern "llvm-intrinsic" have been adjusted as appropriate?

@veluca93

Copy link
Copy Markdown
Contributor Author

Can you check that all places in the compiler that check for extern "llvm-intrinsic" have been adjusted as appropriate?

I gave a look, and I think so, but I am definitely not knowledgeable enough of compiler internals to be sure.

@veluca93
veluca93 marked this pull request as draft October 23, 2026 15:39
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 23, 2026
@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch 2 times, most recently from ebce41f to 90416b5 Compare October 28, 2026 12:15
@veluca93
veluca93 marked this pull request as ready for review October 28, 2026 12:15
@rustbot

rustbot commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred to constck

cc @fee1-dead

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 28, 2026
@rust-log-analyzer

This comment has been minimized.

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 90416b5 to c906c98 Compare October 28, 2026 19:45
@rustbot

rustbot commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Oct 28, 2026
Comment thread compiler/rustc_codegen_gcc/src/lib.rs Resolved
@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from e6d0471 to 7281468 Compare November 7, 2026 13:21
@rust-log-analyzer

This comment has been minimized.

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 7281468 to f6b41d9 Compare November 7, 2026 15:20
@rust-bors

This comment has been minimized.

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from f6b41d9 to 509b32a Compare November 7, 2026 20:49
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 509b32a to 3342826 Compare November 12, 2026 23:42
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 3342826 to 66902f4 Compare November 14, 2026 13:09
@rustbot

rustbot commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 66902f4 to 3717ede Compare November 14, 2026 13:45
@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from 3717ede to eef8844 Compare November 16, 2026 16:10
@rust-bors

This comment has been minimized.

@tgross35 tgross35 left a comment •

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.

One last suggestion but overall this LGTM, as long as the Miri test and tests/ui/consts/const-unstable-intrinsic.rs look good to Ralf.

View changes since this review

@veluca93
veluca93 force-pushed the rustc_llvm_intrinsic branch from eef8844 to b1b5475 Compare November 17, 2026 00:32
@rustbot

rustbot commented Nov 17, 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.

@rust-lang rust-lang deleted a comment from wolfgroup07 Nov 17, 2026
@rust-lang rust-lang deleted a comment from wolfgroup07 Nov 17, 2026
@RalfJung

Copy link
Copy Markdown
Member

Tests LGTM. :)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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-clippy Relevant to the Clippy team. 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.

8 participants