Skip to content

Don't compute FnAbi for LLVM intrinsics in backends#150768

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
bjorn3:llvm_intrinsic_no_fn_abi
Feb 12, 2026
Merged

Don't compute FnAbi for LLVM intrinsics in backends#150768
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
bjorn3:llvm_intrinsic_no_fn_abi

Conversation

@bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jan 7, 2026

This removes support for extern "unadjusted" for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to extern "llvm-intrinsic"?

Follow up to #148533

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 7, 2026
@bjorn3
Copy link
Member Author

bjorn3 commented Jan 7, 2026

cc @sayantn this would make #140763 a tiny bit simpler I think. You don't have to modify compiler/rustc_codegen_llvm/src/abi.rs anymore.

@bjorn3 bjorn3 marked this pull request as ready for review January 7, 2026 16:11
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2026

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

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@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 Jan 7, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2026

r? @wesleywiser

rustbot has assigned @wesleywiser.
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

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the llvm_intrinsic_no_fn_abi branch 2 times, most recently from fb63e0c to af005a9 Compare January 7, 2026 16:30
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the llvm_intrinsic_no_fn_abi branch 2 times, most recently from e48fbd3 to b05795a Compare January 7, 2026 17:53
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the llvm_intrinsic_no_fn_abi branch from b05795a to 83e77ec Compare January 7, 2026 18:44
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the llvm_intrinsic_no_fn_abi branch from 83e77ec to f1ab003 Compare January 8, 2026 10:47
@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2026

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.

@bjorn3 bjorn3 changed the title Don't compute FnAbi for LLVM intrinsics Don't compute FnAbi for LLVM intrinsics in backends Jan 8, 2026
@bjorn3
Copy link
Member Author

bjorn3 commented Jan 8, 2026

I've removed the removal of computing an FnAbi for extern "unadjusted" as miri still depends on it. Will remove it in a follow up PR.

Copy link
Contributor

@sayantn sayantn left a comment

Choose a reason for hiding this comment

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

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 8, 2026

@wesleywiser are you able to review this or should I reroll for review?

self,
sym,
fn_abi.llvm_cconv(self),
llvm::CCallConv,
Copy link
Member

Choose a reason for hiding this comment

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

Is this effectively just a lie? Or how does LLVM model the ABI for intrinsics? Is there a hidden assumption here that intrinsics only ever take ~integers/pointers that don't have any special handling in terms of ABI lowering of the arguments?

Copy link
Member Author

Choose a reason for hiding this comment

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

This matches what was effectively done previously. I don't know if LLVM actually cares about the calling convention for intrinsics. It recognizes intrinsics based on a builtin list of symbol names. (if you declare an llvm.* function that doesn't match a known intrinsic, it will treat it like a regular function and emit an import of said function in the emitted object file)

for fn_attr in fn_ty.fn_attributes {
func.add_attribute(fn_attr);
}
self.on_stack_function_params.borrow_mut().insert(func, FxHashSet::default());
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is the same ABI question as below - we're assuming there's no on-stack parameter passing since it's an intrinsic?

Copy link
Member Author

Choose a reason for hiding this comment

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

extern "unadjusted" previously forced PassMode::Direct for all arguments, which means that on-stack parameters would never occur.

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

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

One question but feel free to r=me

View changes since this review

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 11, 2026

@bors r=wesleywiser

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 11, 2026

📌 Commit fe9715b has been approved by wesleywiser

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 Feb 11, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 11, 2026
…=wesleywiser

Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to rust-lang#148533
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 11, 2026
…=wesleywiser

Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to rust-lang#148533
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 12, 2026
…=wesleywiser

Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to rust-lang#148533
rust-bors bot pushed a commit that referenced this pull request Feb 12, 2026
Rollup of 17 pull requests

Successful merges:

 - #142415 (Add note when inherent impl for a alias type defined outside of the crate)
 - #142680 (Fix passing/returning structs with the 64-bit SPARC ABI)
 - #150768 (Don't compute FnAbi for LLVM intrinsics in backends)
 - #151152 (Add FCW for derive helper attributes that will conflict with built-in attributes)
 - #151814 (layout: handle rigid aliases without params)
 - #151863 (Borrowck: simplify diagnostics for placeholders)
 - #152159 (Add note for `?Sized` params in int-ptr casts diag)
 - #152434 (Clarify names of `QueryVTable` functions for "executing" a query)
 - #152478 (Remove tm_factory field from CodegenContext)
 - #152498 (Partially revert "resolve: Update `NameBindingData::vis` in place")
 - #152316 (fix: add continue)
 - #152394 (Correctly check if a macro call is actually a macro call in rustdoc highlighter)
 - #152425 (Port #![test_runner] to the attribute parser)
 - #152481 (Use cg_ssa's produce_final_output_artifacts in cg_clif)
 - #152485 (fix issue#152482)
 - #152495 (Clean up some subdiagnostics)
 - #152502 (Implement `BinaryHeap::from_raw_vec`)
@rust-bors rust-bors bot merged commit 0041f22 into rust-lang:main Feb 12, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 12, 2026
rust-timer added a commit that referenced this pull request Feb 12, 2026
Rollup merge of #150768 - bjorn3:llvm_intrinsic_no_fn_abi, r=wesleywiser

Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to #148533
@bjorn3 bjorn3 deleted the llvm_intrinsic_no_fn_abi branch February 12, 2026 10:40
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.

6 participants