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

--- Comment #38 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I can build it locally now.  If speculative devirtualization in
semanticallyEquivalent is indeed the trigger I do not see much what is going
wrong here.

We have two targets:

optimized: speculatively devirtualizing call in semanticallyEquivalent/16200 to
getModifier/14399
Indirect call -> speculative call semanticallyEquivalent/16200 =>
getModifier/14399
optimized: speculatively devirtualizing call in semanticallyEquivalent/16200 to
_ZThn8_NK3icu6number4impl15LongNameHandler11getModifierENS1_6SignumENS_1
Indirect call -> speculative call semanticallyEquivalent/16200 =>
_ZThn8_NK3icu6number4impl15LongNameHandler11getModifierENS1_6SignumENS_14StandardPlura
optimized: devirtualized call in semanticallyEquivalent/16200 to 2 targets
  Targets of polymorphic call of type 1311:struct ModifierStore token 2
    Outer type (dynamic):struct ModifierStore (or a derived type) offset 0
    This is partial list; extra targets may be defined in other units. (derived
types included)
       icu::number::impl::AdoptingModifierStore::getModifier non-virtual thunk
to icu::number::impl::LongNameHandler::getModifier(icu::number::impl::Sig

We inline both variants
IPA function summary for semanticallyEquivalent/16200 inlinable
  global time:     109.079979
  self size:       81
  global size:     101
  min size:       95
  self stack:      32
  global stack:    32
  estimated growth:558
    size:59.000000, time:39.760881
    size:3.000000, time:2.000000,  executed if:(not inlined)
    size:0.500000, time:0.500000,  executed if:(op0 not sra candidate) && (not
inlined),  nonconst if:(op0 not sra candidate) && (op0[ref offset: 0] changed)
&& (not inlined)
    size:0.500000, time:0.500000,  executed if:(op0 not sra candidate), 
nonconst if:(op0 not sra candidate) && (op0[ref offset: 0] changed)
    size:0.500000, time:0.500000,  executed if:(op1 not sra candidate) && (not
inlined)
    size:0.500000, time:0.500000,  executed if:(op1 not sra candidate)
    size:0.500000, time:0.045000,  executed if:(op0 not sra candidate) && (not
inlined)
    size:0.500000, time:0.045000,  executed if:(op0 not sra candidate)
  calls:
   
_ZThn8_NK3icu6number4impl15LongNameHandler11getModifierENS1_6SignumENS_14StandardPlural4FormE.artificial_thunk.0/32264
inlined
      freq:0.25 cross module
      Stack frame offset 32, callee self size 0
      getModifier.constprop/32263 inlined
        freq:1.00
        Stack frame offset 32, callee self size 0
    getModifier/38057 inlined
      freq:0.42
      Stack frame offset 32, callee self size 0
   
_ZThn8_NK3icu6number4impl15LongNameHandler11getModifierENS1_6SignumENS_14StandardPlural4FormE.artificial_thunk.0/33463
inlined
      freq:0.25 cross module
      Stack frame offset 32, callee self size 0
      getModifier.constprop/33464 inlined
        freq:1.00
        Stack frame offset 32, callee self size 0
    getModifier/38020 inlined
      freq:0.42
      Stack frame offset 32, callee self size 0
    indirect call loop depth: 2 freq:0.84 size: 6 time: 18
    indirect call loop depth: 2 freq:0.38 size: 7 time: 19
    indirect call loop depth: 2 freq:0.38 size: 7 time: 19
    indirect call loop depth: 0 freq:0.09 size: 6 time: 18
    indirect call loop depth: 0 freq:1.00 size: 5 time: 17
    indirect call loop depth: 0 freq:1.00 size: 5 time: 17

Functions seems to get inlined correctly. So this looks like some optimization
enabled by devirt going wrong.

Reply via email to