Skip to content

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

Open
@dcci

Description

@dcci

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions