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

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 12:27:51 PDT 2018


pcc added a comment.

In https://reviews.llvm.org/D49434#1170189, @steven_wu wrote:

> 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.


I was under the impression that that was how things worked already on Apple platforms but given that it isn't, I agree.

> 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.

I would imagine that folks who care about code size would be linking with `--gc-sections` (or `-dead_strip` in ld64) so the library functions would end up being dropped if they aren't actually needed.


https://reviews.llvm.org/D49434





More information about the llvm-commits mailing list