Code size regression iterating an array (opt-level=z) after 1.82.0
Open
Nobody has claimed this yet.
A-LLVM
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 { a + a }
#[no_mangle]
pub fn g(a: [i32; 5]) -> i32 {
let mut sum = 0;
let arr = [1, 2, 3, 4, 5];
for i in a.iter().chain(arr.iter()) {
sum += i;
}
sum
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Rust example from the issue in the linked Godbolt Compiler Explorer and compare code size with 1.82.0. Investigate the compiler optimization path used for iterating over the chained arrays; done means identifying and correcting the post-1.82.0 regression with coverage for the reported case.
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
- Needs clarification
- Newbie friendliness
- 35/100