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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |ipa
   Last reconfirmed|                            |2024-08-02
           Keywords|                            |missed-optimization
     Ever confirmed|0                           |1
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed:

t.c:26:5: optimized:  Inlined zend_string_release/31 into normal/23 which now
has time 11.000000 and size 18, net change of +13.
t.c:35:9: optimized:  Inlined zend_string_release/32 into unlikely_branch/25
which now has time 29.009000 and size 27, net change of +13.
t.c:42:9: optimized:  Inlined zend_string_release/33 into
unlikely_branch_in_hot_function/26 which now has time 29.009000 and size 27,
net change of +13.

Considering zend_string_release/22 with 19 size
 to be inlined into unlikely_branch/25 in t.c:35
 Estimated badness is -0.000000, frequency 0.00.
    Badness calculation for unlikely_branch/25 -> zend_string_release/22
      size growth 13, time 9.000000 unspec 12.000000
      -0.000000: guessed profile. frequency 0.001000, count -1 caller count -1
time saved 0.014000 overall growth 39 (current) 52 (original) 2704
(compensated)
      Adjusted by hints -0.000000
...
Processing frequency zend_string_release/32
  Called by unlikely_branch/25 that is normal or hot
                Accounting size:-2.00, time:-0.01 on predicate exec:(op1,((long
int) #) != 0) 
                Accounting size:2.00, time:0.00 on new predicate exec:(op0[ref
offset: 32],(# & 2) != 0) && (op0[ref offset: 0],(# + -1) == 0) && (op0[ref
offset: 32],(# & 1) == 0) && (op1,((long int) #) != 0)
                Accounting size:2.00, time:0.00 on new predicate exec:(op0[ref
offset: 32],(# & 2) == 0) && (op0[ref offset: 0],(# + -1) == 0) && (op0[ref
offset: 32],(# & 1) == 0) && (op1,((long int) #) != 0)
t.c:35:9: optimized:  Inlined zend_string_release/32 into unlikely_branch/25
which now has time 29.009000 and size 27, net change of +13.

I'm not sure how our IPA logic goes when optimizing unlikely calls in
normal/hot functions.  The calculations at least do not look much different
compared to inlining into normal().

Note that GCC generally tries to exhaust its inlining budget, but the cold
call should at least make inlining it low priority.

Reply via email to