rust-lang / rust-lang/rust

Code size regression (opt-level=z) after 1.73.0 (~40%)

Open
#132,887 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-heavy P-low regression-untriaged T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code:

#![no_main]
#[no_mangle]
pub fn f(a: i32) -> i32 {
    let mut result = a + a;
    for i in 0..a {
        for j in 0..a {
            if i * j % 2 == 0 && i + j > a / 2 {
                result += i + j;
            }
            for k in 0..a {
                if (i + j + k) % 3 == 0 && (i * j * k) % 2 != 0 {
                    result += k * (i + j);
                }
            }
        }
    }
    result
}

Link: https://godbolt.org/z/cW5KK4ab8

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.

Research direction

Start with the minimal Rust reproducer in the issue and the linked Godbolt comparison, compiling it with opt-level=z around Rust 1.73.0 and the affected version. Compare the generated code size and inspect compiler changes relevant to the regression. Done means identifying the cause and confirming that the reproducer no longer shows the roughly 40% increase.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.