------- Comment #5 from gb-0001 at xsim dot com  2009-11-30 02:14 -------
>[It works in 4.5 with "inline", "always_inline" not needed.]

Ah, I misunderstood -- seems good to me.  I'd say fixed in 4.5 unless somebody
else cares.

Digression: this suggests an attribute such as "inline_if_reduces" which
inlines if the inlined (callee) code is simplified, but otherwise keeps it out
of line.  In other words, code growth is okay, but not when the savings is only
call/return reduction.  For "switch_case()", "inline_if_reduces_50" (inline if
the inlined callee is under 50% of the out-of-line version) would be good:
here, inlining reduces the dynamic code path by about 80% and the inlined code
size (at each caller) is under 5% of the size before inline simplification. 
Except for a slight increase in code size, it is a big enough win in this case
(once the compiler knows some code expansion is okay) to set a crude threshold
that does not need to be precise (what's the size of an x86 instruction vs. a
MIPS instruction, etc.), yet mostly avoids false positives (inlining that hurts
because the simplification is at best minor).  In my experience, the biggest
win from inlining with code growth is cases that get a lot better -- when the
difference is small, out of line is either almost as good or is better.  (End
of digression.)

Thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42209

Reply via email to