rust-lang / rust-lang/rust

Codegen regression of indexing of slice on nightly

Open
#149,673 10 comments 0 reactions 1 assignee View on GitHub

@el-ev is already working on this.

Since May 10, 2026.

A-LLVM C-bug P-medium regression-from-stable-to-stable regression-untriaged S-has-bisection T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Not sure if it is related with LLVM.
https://godbolt.org/z/vhKoWYxM5

#[inline(never)]
pub fn f_index(data: &mut [u32]) {
    for i in 0..data.len() {
        data[i] += 1;
    }
}

Regression part in LBB0_4:

stable:

        mov     rax, rsi
        and     rax, -8
        xor     ecx, ecx
        pcmpeqd xmm0, xmm0

nightly:

        movabs  rax, 2305843009213693944
        and     rax, rsi
        lea     rcx, [4*rsi]
        and     rcx, -32
        xor     edx, edx
        pcmpeqd xmm0, xmm0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.