[llvm-commits] [llvm-gcc-4.2] r51608 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Dale Johannesen dalej at apple.com
Wed May 28 11:11:41 PDT 2008


On May 28, 2008, at 10:55 AM, Evan Cheng wrote:
>>> We want to run llvm inliner pass only when
>>> flag_inline_trees > 1.
>>
>> To get the same effect as gcc in a way that works for all languages,
>> I think we need to run the inliner if flag_inline_trees != 0 and add
>> all functions with !DECL_INLINE to llvm.noinline.  Or would that be
>> too expensive?
>
> That doesn't seem like the right solution to me. llvm language doesn't
> have the "inline" keyword. Can we just say llvm ignore the inline  
> hint?

I don't think that's a good idea; the hint should be added to the IR.
Compilers are not at the point where they can make better decisions
than an intelligent user about which things are good to inline, and  
IMO they
never will be; for example, a user can know that certain calls are or  
aren't
executed frequently.

And honoring no-inline and always-inline is needed for correctness
(assuming we accept GCC extensions as part of the language).

fwiw, the inlining heuristics have changed in each release of gcc, and
are not documented in a fashion useful to end users (to make it easy to
change them, I suspect, although no one is willing to admit it.)  No  
matter
what you do here it is possible to construct cases where something else
is better, IMO.

>>> Perhaps it would be simpler to check for flag_inline_functions
>>> instead
>>> in llvm-backend.cpp?
>>
>> It would be simpler, but it would only work the same way as gcc for
>> the C like languages, and not for Ada or Fortran.
>
> Is it possible to fix the Ada and Fortran frontend to match the C
> frontend?




More information about the llvm-commits mailing list