Skip to content

Conversation

@h3fang
Copy link
Contributor

@h3fang h3fang commented Dec 27, 2025

This pull request tries to fix #150419.

The debuginfo for AArch64 SVE predicates <vscale x N x i1> where N != 16 should be ignored by this commit.

if operand.layout.ty.is_scalable_vector()
&& bx.sess().target.arch == rustc_target::spec::Arch::AArch64
&& let ty::Adt(adt, args) = &operand.layout.ty.kind()
&& let Some(marker_type_field) =
adt.non_enum_variant().fields.get(FieldIdx::from_u32(0))
{
let marker_type = marker_type_field.ty(bx.tcx(), args);
// i.e. `<vscale x N x i1>` when `N != 16`
if let ty::Slice(element_ty) = marker_type.kind()
&& element_ty.is_bool()
&& adt.repr().scalable != Some(ScalableElt::ElementCount(16))
{
return;
}
}

But in line 446, the marker_type.kind() is ty::Bool instead of ty::Slice, so the code doesn't work as intended.

This pull request uses the Ty::scalable_vector_element_count_and_type method to fix the condition checks for <vscale x N x i1> where N != 16 and add a compiletest for this case.

@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 Dec 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 27, 2025

r? @dianqk

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

@h3fang
Copy link
Contributor Author

h3fang commented Dec 27, 2025

r? @davidtwco

@rustbot rustbot assigned davidtwco and unassigned dianqk Dec 27, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

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

I have a few comments about comments and a minor quibble about where to put the test.

View changes since this review

@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 Dec 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 27, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2025

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.

@h3fang
Copy link
Contributor Author

h3fang commented Dec 28, 2025

@rustbot ready

@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 Dec 28, 2025
@workingjubilee
Copy link
Member

Excellent, excellent, happy to have it.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 30, 2025

📌 Commit 4c485a4 has been approved by workingjubilee

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 Dec 30, 2025
bors added a commit that referenced this pull request Dec 30, 2025
…uwer

Rollup of 3 pull requests

Successful merges:

 - #150058 (Enable file locking support for Hurd)
 - #150420 (Do not spill operand debuginfo to stack for AArch64 SVE predicates `<vscale x N x i1>` where `N != 16`)
 - #150501 (Fix Typos in Platform Support Tables)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4b49c9f into rust-lang:main Dec 31, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 31, 2025
rust-timer added a commit that referenced this pull request Dec 31, 2025
Rollup merge of #150420 - h3fang:sve-debuginfo-fix, r=workingjubilee

Do not spill operand debuginfo to stack for AArch64 SVE predicates `<vscale x N x i1>` where `N != 16`

This pull request tries to fix #150419.

The debuginfo for AArch64 SVE predicates `<vscale x N x i1>` where `N != 16` should be ignored by this [commit](89eea57).

https://github.com/rust-lang/rust/blob/89eea57594e3e1d8e618dd530ea1c8e7c9b4c7a4/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs#L438-L452

But in line 446, the `marker_type.kind()` is `ty::Bool` instead of `ty::Slice`, so the code doesn't work as intended.

This pull request uses the [`Ty::scalable_vector_element_count_and_type`](https://github.com/rust-lang/rust/blob/main/compiler/rustc_middle/src/ty/sty.rs#L1272) method to fix the condition checks for  `<vscale x N x i1>` where `N != 16` and add a compiletest for this case.
@davidtwco
Copy link
Member

Thanks for this fix @h3fang and for handling the review @workingjubilee!

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.

LLVM instruction selection error when spilling operand debuginfo to stack for AArch64 SVE predicates <vscale x N x i1> where N != 16

7 participants