This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Sigh. Inlining heuristics.


> Date: Tue, 10 Jul 01 06:30:48 EDT
> From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
> To: mark@codesourcery.com
> Cc: gcc@gcc.gnu.org

>     I agree.  We did this for compatible with the RTL inliner -- which
>     had no limit at all until some time back we made it have 10,000
>     instructions as a limit, to approximate the old behavior but have
>     *some* cap.

> Huh?  The RTL inliner always had a limit, and a relatively small one.
> >From gcc 2.8.1:

> /* Default max number of insns a function can have and still be inline.
>    This is overridden on RISC machines.  */
> #ifndef INTEGRATE_THRESHOLD
> #define INTEGRATE_THRESHOLD(DECL) \
>   (8 * (8 + list_length (DECL_ARGUMENTS (DECL))))
> #endif

Wrong.  Read the rest of the code:

  int max_insns = INTEGRATE_THRESHOLD (fndecl);

  if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
    return N_("function too large to be inline");

  if (!DECL_INLINE (fndecl) && get_max_uid () > max_insns)
    {
      for (ninsns = 0, insn = get_first_nonparm_insn ();
           insn && ninsns < max_insns;
           insn = NEXT_INSN (insn))
        if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
          ninsns++;

      if (ninsns >= max_insns)
        return N_("function too large to be inline");
    }

  return 0;

Notice the !DECL_INLINE part.  When it is true, the first part is
false, and max_insns is never consulted and 0 is returned, and when 0
is returned, inline we do.  Mark was talking about the no limit in the
`inline' case.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]