https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102203

            Bug ID: 102203
           Summary: __builtin_memset and __builtin_memcpy could be
                    expanded inline if range is known to be small
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*-*-*

Take:
typedef decltype(sizeof(0)) size_t;
void g(size_t a, char *d, char *e)
{
  if (a>16)__builtin_unreachable();
  __builtin_memcpy(d, e, a);
}

----- CUT ----
This could be inlined like it is on x86_64.

Reply via email to