memcpy
Richard Henderson
rth@redhat.com
Thu Feb 20 08:56:00 GMT 2003
On Wed, Feb 19, 2003 at 06:32:02PM -0800, Nathan Myers wrote:
> Cool! But why would the optimizer *care* whether s is const, but
> not x and y?
The optimizers don't care; we've lost before we get that far.
The inliner is dumb though, and won't substitute constants
unless the parameter is const. This is because it does no
data flow. However if the parameter is const, it gets this
info for free.
The builtin expander cares whether or not s is constant
because it is unwilling to expand code inline to handle
arbitrary sizes. Which is reasonable. At present, however,
the builtin expander is run before the optimizers so we don't
get a chance to do normal constant propagation.
> But it seems to me the compiler would be freer the other way,
> allowed to clobber the registers that x, y, and s are (were) in.
We're way before even thinking about registers. We're not
constraining the register allocator one whit.
r~
More information about the Libstdc++
mailing list