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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Last reconfirmed|                            |2023-02-21
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
That means it was a conscious decision.

IPA function summary for f1()::<lambda(auto:1&&)> [with auto:1 = int
(A::*)(int)]/1 inlinable
  global time:     30.500000
  self size:       23
  global size:     25

the body is

  <bb 2> [local count: 1073741824]:
  _1 = f_18(D)->__pfn;
  _2 = (long int) _1;
  _3 = _2 & 1;
  if (_3 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870913]:
  _4 = __closure_19(D)->__a;
  _5 = f_18(D)->__delta;
  _6 = (sizetype) _5;
  _7 = _4 + _6;
  _8 = *_7;
  _9 = _2 + -1;
  _10 = (sizetype) _9;
  _11 = _8 + _10;
  iftmp.0_20 = *_11;

  <bb 4> [local count: 1073741824]:
  # iftmp.0_16 = PHI <iftmp.0_20(3), _1(2)>
  _12 = __closure_19(D)->__a;
  _13 = f_18(D)->__delta;
  _14 = (sizetype) _13;
  _15 = _12 + _14;
  _22 = iftmp.0_16 (_15, 42);
  return _22;

so it is quite large.

While we can give inline incentives in IPA inlining we do not discover the
inline target there - the above has it also well obfuscated.  Maybe we
can still compute the set of functions possibly called here and perform
speculative inlining in IPA?

Maybe the frontend can also improve the initial IL which looks like

  <<cleanup_point return <retval> = (((long int) f->__pfn & 1) != 0) ? (int
A::<T3f8> (struct A *, int) *) *(*((int (*) () * *) a + (sizetype) f->__delta)
+ (sizetype) ((long int) f->__pfn + -1)) : f->__pfn ((struct A *) a +
(sizetype) f->__delta, 42)>>;

Reply via email to