Skip to content

vectorization regression in Clang 19 #114856

@eyelash

Description

@eyelash

When compiling the following code on x86-64 with -O2

void foo(float* result, int size, float y, float delta) {
    for (int t = 0; t < size; ++t) {
        result[t] = y + delta * t;
    }
}

Clang generates a lot of code that seems suboptimal. After asking on Stack Overflow I was told that this is a regression in Clang 19 that I should report here. The comments and this answer on Stack Overflow shed more light into what's going on.

Here's a link to this example on Compiler Explorer with Clang trunk that shows the suboptimal assembly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions