[PATCH] D49434: Put "built-in" function definitions in global Used list, for LTO. (fix bug 34169)

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 11:34:23 PDT 2018


steven_wu added a comment.

For the old API, I don't think it is reasonable to expect user or linker to pass in the correct preserve list. There is likely no knowledge outside the LTO modules that these lib funcs are needed.

In https://reviews.llvm.org/D49434#1168948, @tejohnson wrote:

> In https://reviews.llvm.org/D49434#1168858, @cmtice wrote:
>
> > The old LTO implementation still internalizes the function definitions, but they do not get Dead Code Eliminated.
>
>
> Quick clarification based on our discussion earlier - the old LTO implementation internalizes but does not eliminate with regular LTO. The old LTO implementation with ThinLTO is still broken (hence that part of the test is currently disabled).


This also sounds pretty fragile (not just LTO, but in general). If you have a module with implementation of memcpy and all you have is memcpy builtin function, DCE might just cause linker failure. I wonder the problem should be solved in a lower level.
People who actually implement libfunc in the module are probably working on some embedded environment and code size is probably a big concern. It would be good if those libfuncs can be eliminated when it is safe to do so.


https://reviews.llvm.org/D49434





More information about the llvm-commits mailing list