This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/53253] New: Missed opportunity to inline memcmp
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 06 May 2012 04:04:53 +0000
- Subject: [Bug tree-optimization/53253] New: Missed opportunity to inline memcmp
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53253
Bug #: 53253
Summary: Missed opportunity to inline memcmp
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: law@redhat.com
Compile with -O2. Note the length of the memory to be compared via memcmp is
fixed and just 2 bytes. It'd be more efficient and possibly smaller to just
inline the necessary comparisons. Seems to me this ought to be addressed in
our tree optimizers.
int foo(const char* x) {
return memcmp(x,"xx",2) != 0;
}