This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/84029] New: Partially inline strcmp
- From: "wilco at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Jan 2018 19:06:01 +0000
- Subject: [Bug middle-end/84029] New: Partially inline strcmp
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84029
Bug ID: 84029
Summary: Partially inline strcmp
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: wilco at gcc dot gnu.org
Target Milestone: ---
Initial performance results for PR78809 suggest that partial inlining of strcmp
may be beneficial. We could inline the first character comparison before
calling strcmp:
if ((res = s[0] - t[0]) == 0)
res = strcmp (s, t);
Such a check would have low overhead and improve performance if the first
character often mismatches. Checking for more characters is possible, but would
have a higher overhead. strncmp and memcmp could do something similar.