Skip to content

asm const ptr: move name generation to asm-specific logic - #164808

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
folkertdev:asm-const-ptr-move-name
Nov 16, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
folkertdev:asm-const-ptr-move-name

Conversation

@folkertdev

@folkertdev folkertdev commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

tracking issue: #128464

I'm trying to make a fix for #164774, and this name generation gets in the way.

So, move the logic needed to give constants that are passed to global assembly a globally unique name out of the generic helper, and into asm-specific logic instead.

LLVM Values are deduplicated so we need to prevent generating a globally unique name for the same value multiple times. So, I added a small cache. A benefit is that we also deduplicate LLVM constants now, compare the added test versus https://godbolt.org/z/1ajW19hdT.

r? codegen
cc @nbdd0121

@rustbot rustbot added 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 23, 2026
@folkertdev

Copy link
Copy Markdown
Contributor Author

r? @Amanieu

@Amanieu

Amanieu commented Nov 13, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c3318cb has been approved by Amanieu

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
…, r=Amanieu

asm const ptr: move name generation to asm-specific logic

tracking issue: rust-lang#128464

I'm trying to make a fix for rust-lang#164774, and this name generation gets in the way.

So, move the logic needed to give constants that are passed to global assembly a globally unique name out of the generic helper, and into asm-specific logic instead.

LLVM `Value`s are deduplicated so we need to prevent generating a globally unique name for the same value multiple times. So, I added a small cache. A benefit is that we also deduplicate LLVM constants now, compare the added test versus https://godbolt.org/z/1ajW19hdT.

r? codegen
cc @nbdd0121
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 13, 2026
Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: rust-lang#68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on rust-lang#164808.

Best reviewed commit-by-commit.
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
Rollup of 17 pull requests

Successful merges:

 - #160618 (require a consistent codegen backend when -Zllvm-target-feature is present)
 - #164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`)
 - #164808 (asm const ptr: move name generation to asm-specific logic)
 - #164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow)
 - #165475 (Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable)
 - #165568 (rustdoc: Suggest corrections for reference label typos)
 - #165924 (rustc_codegen_gcc subtree update 2026-11-13)
 - #165927 (Remove `const_struct` from `rustc_codegen_ssa`)
 - #164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`)
 - #164997 (Fix as str suggestion in subpattern)
 - #165825 (make `Complex<x87_f80>` ABI-compatible with C)
 - #165868 (Small changes to dyn compatibility)
 - #165879 (Add `#[rustc_test_entrypoint_marker]` back !)
 - #165903 (Fix borrowck ICE when a borrow outlives a local in a const block)
 - #165914 (Use `trim_prefix` in bootstrap)
 - #165919 (tests: accept better behavior on underaligned accesses)
 - #165936 (Enhance documentation for try_clone File implementation)
@Zalathar

Copy link
Copy Markdown
Member

@bors r-

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 14, 2026
@rust-bors

rust-bors Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#165944), which was unapproved.

View changes since this unapproval

Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 14, 2026
Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: rust-lang#68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on rust-lang#164808.

Best reviewed commit-by-commit.
@folkertdev
folkertdev force-pushed the asm-const-ptr-move-name branch from c3318cb to 7bd8bb0 Compare November 14, 2026 11:50
@rustbot

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

@folkertdev

Copy link
Copy Markdown
Contributor Author

@bors r=Amanieu

@rust-bors

rust-bors Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7bd8bb0 has been tentatively approved by Amanieu

It will be put into the queue for this repository once PR CI succeeds.

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

Reason for tree closure: consistent failures on main

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 14, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 14, 2026
…, r=Amanieu

asm const ptr: move name generation to asm-specific logic

tracking issue: rust-lang#128464

I'm trying to make a fix for rust-lang#164774, and this name generation gets in the way.

So, move the logic needed to give constants that are passed to global assembly a globally unique name out of the generic helper, and into asm-specific logic instead.

LLVM `Value`s are deduplicated so we need to prevent generating a globally unique name for the same value multiple times. So, I added a small cache. A benefit is that we also deduplicate LLVM constants now, compare the added test versus https://godbolt.org/z/1ajW19hdT.

r? codegen
cc @nbdd0121
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 14, 2026
Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: rust-lang#68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on rust-lang#164808.

Best reviewed commit-by-commit.
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 14, 2026
…, r=Amanieu

asm const ptr: move name generation to asm-specific logic

tracking issue: rust-lang#128464

I'm trying to make a fix for rust-lang#164774, and this name generation gets in the way.

So, move the logic needed to give constants that are passed to global assembly a globally unique name out of the generic helper, and into asm-specific logic instead.

LLVM `Value`s are deduplicated so we need to prevent generating a globally unique name for the same value multiple times. So, I added a small cache. A benefit is that we also deduplicate LLVM constants now, compare the added test versus https://godbolt.org/z/1ajW19hdT.

r? codegen
cc @nbdd0121
rust-bors Bot pushed a commit that referenced this pull request Nov 16, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #165928 (Replace most uses of `type_array` with `type_byte_array` in `rustc_codegen_llvm`)
 - #160618 (require a consistent codegen backend when -Zllvm-target-feature is present)
 - #161950 (Ensure floats are returned losslessly by the C ABI on 32-bit x86)
 - #162267 (Fix an edge within `std::fs::create_dir_all` for certain platforms that views trailing cur dir components as a separate missing directory components)
 - #164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`)
 - #164808 (asm const ptr: move name generation to asm-specific logic)
 - #164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow)
 - #165568 (rustdoc: Suggest corrections for reference label typos)
 - #165641 (Treat all proc macro dependencies as host dependencies in bootstrap)
 - #165924 (rustc_codegen_gcc subtree update 2026-11-13)
 - #165927 (Remove `const_struct` from `rustc_codegen_ssa`)
 - #163696 (Stabilize `int_from_ascii`)
 - #163882 (docs(vec): clarify into_boxed_slice allocation guarantee)
 - #164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`)
 - #164465 (Under `guard_patterns` allow parenthesized guarded patterns in match arms)
 - #164997 (Fix as str suggestion in subpattern)
 - #165825 (make `Complex<x87_f80>` ABI-compatible with C)
 - #165868 (Small changes to dyn compatibility)
 - #165879 (Add `#[rustc_test_entrypoint_marker]` back !)
 - #165902 (Add allocator() to vec_deque::IntoIter and vec_deque::Drain)
 - #165903 (Fix borrowck ICE when a borrow outlives a local in a const block)
 - #165914 (Use `trim_prefix` in bootstrap)
 - #165919 (tests: accept better behavior on underaligned accesses)

Failed merges:

 - #165893 (Prune un/under used methods of `ast::Attribute`)
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 16, 2026
Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: rust-lang#68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on rust-lang#164808.

Best reviewed commit-by-commit.
rust-bors Bot pushed a commit that referenced this pull request Nov 16, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #165928 (Replace most uses of `type_array` with `type_byte_array` in `rustc_codegen_llvm`)
 - #160618 (require a consistent codegen backend when -Zllvm-target-feature is present)
 - #161950 (Ensure floats are returned losslessly by the C ABI on 32-bit x86)
 - #162267 (Fix an edge within `std::fs::create_dir_all` for certain platforms that views trailing cur dir components as a separate missing directory components)
 - #164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`)
 - #164808 (asm const ptr: move name generation to asm-specific logic)
 - #164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow)
 - #165568 (rustdoc: Suggest corrections for reference label typos)
 - #165641 (Treat all proc macro dependencies as host dependencies in bootstrap)
 - #165924 (rustc_codegen_gcc subtree update 2026-11-13)
 - #165927 (Remove `const_struct` from `rustc_codegen_ssa`)
 - #163696 (Stabilize `int_from_ascii`)
 - #163882 (docs(vec): clarify into_boxed_slice allocation guarantee)
 - #164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`)
 - #164465 (Under `guard_patterns` allow parenthesized guarded patterns in match arms)
 - #164997 (Fix as str suggestion in subpattern)
 - #165825 (make `Complex<x87_f80>` ABI-compatible with C)
 - #165868 (Small changes to dyn compatibility)
 - #165879 (Add `#[rustc_test_entrypoint_marker]` back !)
 - #165902 (Add allocator() to vec_deque::IntoIter and vec_deque::Drain)
 - #165903 (Fix borrowck ICE when a borrow outlives a local in a const block)
 - #165914 (Use `trim_prefix` in bootstrap)
 - #165919 (tests: accept better behavior on underaligned accesses)

Failed merges:

 - #165893 (Prune un/under used methods of `ast::Attribute`)
@rust-bors
rust-bors Bot merged commit daf226e into rust-lang:main Nov 16, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 16, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 16, 2026
Rollup merge of #164808 - folkertdev:asm-const-ptr-move-name, r=Amanieu

asm const ptr: move name generation to asm-specific logic

tracking issue: #128464

I'm trying to make a fix for #164774, and this name generation gets in the way.

So, move the logic needed to give constants that are passed to global assembly a globally unique name out of the generic helper, and into asm-specific logic instead.

LLVM `Value`s are deduplicated so we need to prevent generating a globally unique name for the same value multiple times. So, I added a small cache. A benefit is that we also deduplicate LLVM constants now, compare the added test versus https://godbolt.org/z/1ajW19hdT.

r? codegen
cc @nbdd0121
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 16, 2026
Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: rust-lang#68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on rust-lang#164808.

Best reviewed commit-by-commit.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 16, 2026
Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: rust-lang#68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on rust-lang#164808.

Best reviewed commit-by-commit.
rust-bors Bot pushed a commit that referenced this pull request Nov 16, 2026
Rollup merge of #165475 - folkertdev:vfe-upcast, r=WaffleLapkin

Add a `!type` annotation to a vtable for every supertrait that is a prefix of the vtable

tracking issue: #68262

This fixes a miscompilation where a vtable was incorrectly eliminated because it was only used by a supertrait.

In https://godbolt.org/z/8TE1WMvac, `call_super` could be applied to both `A` and `B`, but it incorrectly just always calls the `B` method. The vtable for A has been eliminated.

The fix here only works for the first supertrait in the list, or later ones if they have no methods. So in `trait Foo: A + B`, there is still a bug when B actually has methods (and its vtable is not a prefix of `Foo`s vtable).

In that case the vtable for `B` does not get any `!type` annotations, which provides incomplete information to VFE and it may therefore miscompile. That needs some further refactoring, which is blocked on #164808.

Best reviewed commit-by-commit.
sushink70 pushed a commit to sushink70/miri that referenced this pull request Nov 17, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - rust-lang/rust#165928 (Replace most uses of `type_array` with `type_byte_array` in `rustc_codegen_llvm`)
 - rust-lang/rust#160618 (require a consistent codegen backend when -Zllvm-target-feature is present)
 - rust-lang/rust#161950 (Ensure floats are returned losslessly by the C ABI on 32-bit x86)
 - rust-lang/rust#162267 (Fix an edge within `std::fs::create_dir_all` for certain platforms that views trailing cur dir components as a separate missing directory components)
 - rust-lang/rust#164043 (alloc: Unstably add `Vec::repeat` and `Vec::repeat_in`)
 - rust-lang/rust#164808 (asm const ptr: move name generation to asm-specific logic)
 - rust-lang/rust#164823 (Use `DerefMut` and `IndexMut` before `&raw mut` autoborrow)
 - rust-lang/rust#165568 (rustdoc: Suggest corrections for reference label typos)
 - rust-lang/rust#165641 (Treat all proc macro dependencies as host dependencies in bootstrap)
 - rust-lang/rust#165924 (rustc_codegen_gcc subtree update 2026-11-13)
 - rust-lang/rust#165927 (Remove `const_struct` from `rustc_codegen_ssa`)
 - rust-lang/rust#163696 (Stabilize `int_from_ascii`)
 - rust-lang/rust#163882 (docs(vec): clarify into_boxed_slice allocation guarantee)
 - rust-lang/rust#164362 (Emit note for `non_exhaustive` within defining crate for `unreachable_patterns`)
 - rust-lang/rust#164465 (Under `guard_patterns` allow parenthesized guarded patterns in match arms)
 - rust-lang/rust#164997 (Fix as str suggestion in subpattern)
 - rust-lang/rust#165825 (make `Complex<x87_f80>` ABI-compatible with C)
 - rust-lang/rust#165868 (Small changes to dyn compatibility)
 - rust-lang/rust#165879 (Add `#[rustc_test_entrypoint_marker]` back !)
 - rust-lang/rust#165902 (Add allocator() to vec_deque::IntoIter and vec_deque::Drain)
 - rust-lang/rust#165903 (Fix borrowck ICE when a borrow outlives a local in a const block)
 - rust-lang/rust#165914 (Use `trim_prefix` in bootstrap)
 - rust-lang/rust#165919 (tests: accept better behavior on underaligned accesses)

Failed merges:

 - rust-lang/rust#165893 (Prune un/under used methods of `ast::Attribute`)
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.

5 participants