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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
You could also say rtl-optimization does a bad job with the inlined version.
Or we should inline strcmp on GIMPLE to get the first char optimized.

Consider

 strcmp (c, "ABCDEFGHabcdefgh")
 || strcmp (c, "ABCDEFGHfoobar")

thus strings with a common prefix which we could optimize as

 strncmp (c, "ABCDEFGH", 8)
 && (strcmp (c+8, "abcdefgh")
     || strcmp (c+8, "foobar"))

as a more general transform.

I should say inline_string_cmp should consider using larger unaligned
reads as well.

Reply via email to