https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65740

--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Negative badness values are expected (it is really a negation of goodness).
Independently on that the inliner should skip inlining when it thinks code size
will grow:

Considering void move3Servos(Servo, float, Servo, float, Servo, float, float)
with 87 size
 to be inlined into void loop() in oiOSoul.ino:325
 Estimated growth after inlined into all is +412 insns.
 Estimated badness is -1073741824, frequency 0.01.
 Inlined into void loop() which now has time 351 and size 628,net change of +0.

Here it thinks the size increase is 0 (net change). Size estimates are context
sensitie and for this particular context it apparently ended up being 0.

GCC 4.8 (unlike mainline) seem to think that a lot of code is optimized out
under various conditions on parameters:

Inline summary for void move3Servos(Servo, float, Servo, float, Servo, float,
float)/90 inlinable
  self time:       4586
  global time:     0
  self size:       87
  global size:     0
  self stack:      0
  global stack:    0
    size:0.000000, time:0.000000, predicate:(true)
    size:2.000000, time:0.000000, predicate:(not inlined)
    size:2.000000, time:2.000000, predicate:(op1 changed)
    size:2.000000, time:0.990000, predicate:(op1 changed) && (op1 not constant)
    size:2.000000, time:2.000000, predicate:(op3 changed) && (op1 < 6.0e+2 ||
op1 > 2.4e+3 || op1 not constant) && (op1 < 6.0e+2 || op1 not constant)
    size:2.000000, time:0.990000, predicate:(op3 changed) && (op3 not constant)
&& (op1 < 6.0e+2 || op1 > 2.4e+3 || op1 not constant) && (op1 < 6.0e+2 || op1
not constant)
    size:2.000000, time:2.000000, predicate:(op5 changed) && (op3 < 6.0e+2 ||
op3 > 2.4e+3 || op3 not constant) && (op3 < 6.0e+2 || op3 not constant) && (op1
< 6.0e+2 || op1 > 2.4e+3 || op1 not constant) && (op1 < 6.0e+2 || op1 not
constant)
    size:2.000000, time:0.990000, predicate:(op5 changed) && (op5 not constant)
&& (op3 < 6.0e+2 || op3 > 2.4e+3 || op3 not constant) && (op3 < 6.0e+2 || op3
not constant) && (op1 < 6.0e+2 || op1 > 2.4e+3 || op1 not constant) && (op1 <
6.0e+2 || op1 not constant)
    size:2.000000, time:2.000000, predicate:(op6 changed) && (op5 < 6.0e+2 ||
op5 > 2.4e+3 || op5 not constant) && (op5 < 6.0e+2 || op5 not constant) && (op3
< 6.0e+2 || op3 > 2.4e+3 || op3 not constant) && (op3 < 6.0e+2 || op3 not
constant) && (op1 < 6.0e+2 || op1 > 2.4e+3 || op1 not constant) && (op1 <
6.0e+2 || op1 not constant)
    size:2.000000, time:1.450000, predicate:(op6 changed) && (op6 not constant)
&& (op5 < 6.0e+2 || op5 > 2.4e+3 || op5 not constant) && (op5 < 6.0e+2 || op5
not constant) && (op3 < 6.0e+2 || op3 > 2.4e+3 || op3 not constant) && (op3 <
6.0e+2 || op3 not constant) && (op1 < 6.0e+2 || op1 > 2.4e+3 || op1 not
constant) && (op1 < 6.0e+2 || op1 not constant)
    size:48.000000, time:1980.374000, predicate:(op6 < 0.0 || op6 > 5.0e+0 ||
op6 not constant) && (op6 < 0.0 || op6 not constant) && (op5 < 6.0e+2 || op5 >
2.4e+3 || op5 not constant) && (op5 < 6.0e+2 || op5 not constant) && (op3 <
6.0e+2 || op3 > 2.4e+3 || op3 not constant) && (op3 < 6.0e+2 || op3 not
constant) && (op1 < 6.0e+2 || op1 > 2.4e+3 || op1 not constant) && (op1 <
6.0e+2 || op1 not constant)
    size:1.000000, time:1.982000, predicate:(op6 < 0.0 || op6 > 5.0e+0 || op6
not constant) && (op6 < 0.0 || op6 not constant) && (op5 < 6.0e+2 || op5 >
2.4e+3 || op5 not constant) && (op5 < 6.0e+2 || op5 not constant) && (op3 <
6.0e+2 || op3 > 2.4e+3 || op3 not constant) && (op3 < 6.0e+2 || op3 not
constant) && (op1 < 6.0e+2 || op1 > 2.4e+3 || op1 not constant) && (not inlined

I will verify tomorrow if that match reality at all.

Reply via email to