http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53726
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution| |WORKSFORME --- Comment #21 from H.J. Lu <hjl.tools at gmail dot com> 2012-06-21 12:55:33 UTC --- (In reply to comment #18) > > string/memory functions in libc can be much faster than the ones generated > > by GCC unless the size is very small, PR 43052. > > Yes. The question is what is "very small" and how can we possibly > detect "very small". For this testcase we can derive an upper bound > of the size, which is 8, but the size is not constant. I think unless > we know we can expand the variable-size memcpy with, say, three > CPU instructions inline there is no reason to not call memcpy. It is OK to call memcpy if the size isn't constant. > > Which would leave us to inline expanding the case of at most 2 byte > memcpy. Of course currently there is no way to record an upper > bound for the size (we do not retain value-range information - but > we of course should). It is nice to have. We can open another bug for this.