Bug 53253 - Missed opportunity to inline memcmp
Summary: Missed opportunity to inline memcmp
Status: RESOLVED DUPLICATE of bug 52171
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-06 04:04 UTC by Jeffrey A. Law
Modified: 2012-05-07 09:22 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-05-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey A. Law 2012-05-06 04:04:53 UTC
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;
}
Comment 1 Andrew Pinski 2012-05-06 04:50:47 UTC
Confirmed.
Comment 2 Andrew Pinski 2012-05-06 04:55:21 UTC
Related also to PR 12086.
Comment 3 Richard Biener 2012-05-07 09:22:57 UTC
This is a dup of 52171.  RTL/expand parts are tracked in PR12086.

*** This bug has been marked as a duplicate of bug 52171 ***