surprising optimization results

Joe Buck jbuck@synopsys.COM
Mon Aug 16 06:31:00 GMT 1999


> Inlines which call and return by value (even struct value) are showing
> up consistently faster in my tests than the equivalent inlines which
> call and return using non-const reference args (gcc configuration
> below).  Assuming this is a real effect, it is surprising to me -- but
> perhaps not to those more familiar with gcc's optimization strategies
> (maybe by-value makes alias analysis easier?).  Any insight into tuning
> my code for gcc-optimizability is appreciated...

Inline functions in gcc suffer because gcc makes a decision too early
about what needs to go into memory.  In this case, I believe it is because
the arguments have their addresses taken, they are forced to memory.
After inlining, arguably there is no longer any object that has its
address taken..  But often the generated code still has dead stores
in it (structs or classes written to memory and never read back).


More information about the Gcc mailing list