[PATCH] D50017: ELF: Add libcall symbols to the link when LTO is being used.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 15:38:41 PDT 2018


pcc added a comment.

In https://reviews.llvm.org/D50017#1181200, @ruiu wrote:

> It might be a silly question, but are these functions (e.g. __udivhi3 or __mulxf3) are functions in static archives?


Yes, they're typically in something like libgcc.a or libcompiler-rt.a, and in principle that archive could have been compiled with LTO. Something that's more likely to happen is illustrated by my test case: a program defines a function that's intended to be defined by the user, such as `__cyg_profile_func_enter_bare`, compiles it with LTO (as with the rest of the program) and links it using an archive.

> It seems like calling such small functions have relatively large overhead, which appears contrary to the aim of LTO. I'm wondering why LTO creates new function calls to them. Don't you want to inline these functions using LTO?

In this case we cannot inline the functions because the IR does not reference them explicitly. The code generator creates the references to them very late (i.e. after inlining) to compile certain mathematical operations (such operations may themselves have been created as a result of inlining followed by other optimizations).


Repository:
  rL LLVM

https://reviews.llvm.org/D50017





More information about the llvm-commits mailing list