[Bug tree-optimization/53253] New: Missed opportunity to inline memcmp

law at redhat dot com gcc-bugzilla@gcc.gnu.org
Sun May 6 04:08:00 GMT 2012


             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;

More information about the Gcc-bugs mailing list