rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.94k stars 12.78k forks source link

Code size regression iterating an array (opt-level=z) after 1.82.0 #132890

Open dcci opened 2 weeks ago

dcci commented 2 weeks ago

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
}

Link: https://godbolt.org/z/14KM5KnPx

jieyouxu commented 2 weeks ago

Following prio triage discussions: @rustbot label -I-prioritize +P-low