https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124035
Bug ID: 124035
Summary: GCC does not support early inlining of memcpy of
non-power-of 2
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: tnfchris at gcc dot gnu.org
Target Milestone: ---
The following
void f(char *a, char *b, unsigned s)
{
__builtin_memcpy (a, b, 4);
}
void g(char *a, char *b, unsigned s)
{
__builtin_memcpy (a, b, 3);
}
f is inlined early but not g, which means if inside a loop we won't vectorize
like clang does.
GCC only seems to do early inlining when the copy amount if a power of two