Skip to content

Introduce InstanceKind::LlvmIntrinsic#159183

Open
bjorn3 wants to merge 2 commits into
rust-lang:mainfrom
bjorn3:instance_llvm_intrinsic
Open

Introduce InstanceKind::LlvmIntrinsic#159183
bjorn3 wants to merge 2 commits into
rust-lang:mainfrom
bjorn3:instance_llvm_intrinsic

Conversation

@bjorn3

@bjorn3 bjorn3 commented Jul 12, 2026

Copy link
Copy Markdown
Member

View all comments

This way codegen backends don't have to check for a magic symbol name prefix to detect LLVM intrinsic calls and thus can more easily handle them separately as necessary.

@rustbot

rustbot commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

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

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

@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 Jul 12, 2026
@rustbot

rustbot commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

rustbot has assigned @folkertdev.
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 75 candidates
  • Random selection from 18 candidates

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from e14ca78 to b7990f6 Compare July 12, 2026 16:24
Comment thread src/tools/miri/src/intrinsics/mod.rs Outdated
this, link_name, args, &dest,
),
_ => interp_ok(EmulateItemResult::NotSupported),
};

@bjorn3 bjorn3 Jul 12, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@RalfJung would you prefer if this match was a method in shims/mod.rs?

View changes since the review

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.

Eventually, all the LLVM shims should be moved to intrinsics.

Up to you if you want to do that in this PR. But if you don't, then please leave the logic entirely inside shims rather than splitting it between shims and intrinsics.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've moved it back to shims for now with a FIXME to move it to intrinsics.

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from b7990f6 to caeec62 Compare July 12, 2026 17:11
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from caeec62 to 1f3938a Compare July 12, 2026 18:03
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from 1f3938a to a06a06e Compare July 12, 2026 18:12
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from a06a06e to cb285fe Compare July 12, 2026 19:52
@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from cb285fe to 04d1d47 Compare July 12, 2026 20:38
Comment thread compiler/rustc_const_eval/src/interpret/machine.rs Outdated
Comment thread src/tools/miri/src/intrinsics/mod.rs Outdated
Comment thread src/tools/miri/src/intrinsics/mod.rs Outdated
this, link_name, args, &dest,
),
_ => interp_ok(EmulateItemResult::NotSupported),
};

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.

Eventually, all the LLVM shims should be moved to intrinsics.

Up to you if you want to do that in this PR. But if you don't, then please leave the logic entirely inside shims rather than splitting it between shims and intrinsics.

@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from dac9874 to 2354759 Compare July 13, 2026 12:56
Comment thread src/tools/miri/src/intrinsics/mod.rs Outdated
Comment thread src/tools/miri/src/shims/foreign_items.rs Outdated

@RalfJung RalfJung 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.

r=me on the Miri changes

View changes since this review

@RalfJung

Copy link
Copy Markdown
Member

Oh wait nvm there was the EmulateItemResult discussion.

@bjorn3

bjorn3 commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

Ok if I squash the first four commits?

@RalfJung RalfJung 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.

Now for real, r=me on the Miri parts. :)

And yeah fine for me to squash.

View changes since this review

bjorn3 added 2 commits July 13, 2026 14:20
This way codegen backends don't have to check for a magic symbol name
prefix to detect LLVM intrinsic calls and thus can more easily handle
them separately as necessary.
@bjorn3 bjorn3 force-pushed the instance_llvm_intrinsic branch from 0d67630 to aec727f Compare July 13, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants