-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
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.