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

--- Comment #9 from Wilco <wdijkstr at arm dot com> ---
(In reply to Qing Zhao from comment #7)

str(n)cmp with a constant string can be changed into memcmp if the string has a
known alignment or is an array of known size. We should check the common cases
are implemented.

Given it takes just 3 instructions per character on almost all targets, it is
reasonable to inline strcmp with a small string if it cannot be changed into
memcmp. This will be faster than calling strcmp due to the overhead of the
call, the plt redirection and alignment checks. Note also that many strcmp
implementations will do a byte-by-byte check if the strings are not aligned.

Reply via email to