https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90304
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|-O3 vectorization gets |-O3 vectorization gets
|worse when code is moved |worse when code is inlined
|into main() |
Keywords| |alias
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Testcase:
int* ptr();
int f()
{
int*__restrict result = ptr();
int* first = ptr();
int* second = ptr();
for (int i = 0; i < 1024; ++i)
result[i] = first[i] * second[i];
}
__attribute__((noinline))
void func(int*__restrict result, int* first, int* second)
{
for (int i = 0; i < 1024; ++i)
result[i] = first[i] * second[i];
}
int g()
{
func(ptr(), ptr(), ptr());
}
Notice func is vectorized while f is not.